nakovn
(Lequocnam2010)
1
Please help me!
This is my code:
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'employee-grid',
'dataProvider' => $em,
'columns' => $attribute,
'filter' => $em->model,
'selectableRows'=> 1,
'selectionChanged'=>'function(id){
var ids = $.fn.yiiGridView.getSelection(id);
$("#MHRRewardEmployee_employee_id").val(ids);
}',
));
oxigen
(Vanminh0312)
2
use js found id, then ajax request to get row details update for form
nakovn
(Lequocnam2010)
3
Thanks @oxigen for reply!
I’m a newbie, and i don’t know how to get data from selected row to update the textField.
Can you help me?
oxigen
(Vanminh0312)
4
Try follow code:
Yii::app()->clientScript->registerScript('UpdateForm', "
$('body').delegate('#employee-grid tbody > tr','click',function(){
var id = $.fn.yiiGridView.getKey('employee-grid', $('#employee-grid tbody > tr').index(this));
//request ajax update form
$.getJSON('/path/to/get/details', {id:id}, function(data){
//TODO: update form data
});
});
");
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'employee-grid',
'dataProvider' => $em,
'columns' => $attribute,
'filter' => $em->model,
));