<?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
答案 0 :(得分:0)
试试这个:
$('#message-grid tbody tr').live('dbclick', function() {
var id = $.fn.yiiGridView.getKey(
'message-grid',
$(this).prevAll().length
);
});
答案 1 :(得分:0)
下面的代码将加载项目的视图页面。 (url =&gt; 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);}',