3
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'message-grid',
    //'selectionChanged'=>'js:function(id){location.href = "'.$this->createUrl('view').'/id/"+$.fn.yiiGridView.getSelection(id);}', 
    'selectionChanged'=>'function(id){location.href = "'.$this->createUrl('view').'&id="+$.fn.yiiGridView.getSelection(id)+"&f=s";}',
//'dataProvider'=>$model->sentitem(),
    'dataProvider'=>$model->search(),    
'filter'=>$model,
    'columns'=>array(
            array(      
                        'class'=>'CCheckBoxColumn',
                        'id'=>'chk',
                        'selectableRows'=>'2',
                        //'htmlOptions'=>array('width'=>'40px'),

            ),

), ));

我已经编写了通过选择更改单击的代码我正在尝试通过 jquery dbclick 函数访问 id,我不知道如何使用在 dbclick 中更改的选择来获取 id

4

2 回答 2

0

尝试这个:

$('#message-grid tbody tr').live('dbclick', function() {
    var id = $.fn.yiiGridView.getKey(
        'message-grid',
        $(this).prevAll().length 
    );
});
于 2012-09-07T13:32:53.983 回答
0

以下代码将加载项目的查看页面。( url => itemcontroller/view/id/+selectedId )

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'id-grid',
    'dataProvider'=>$dataProvider,
    'filter'=>$model,

    'selectableRows'=>1,
    'selectionChanged'=>'function(id){ location.href = "'.$this->createUrl('view').'/id/"+$.fn.yiiGridView.getSelection(id);}',
于 2015-05-19T13:30:57.553 回答