Closed marjss closed 9 years ago
How did you setup the ajax calls on both grids?
On my first Grid::
array(
'class'=>'yiiwheels.widgets.toggle.WhToggleColumn',
'toggleAction'=>'Trainerdetails/toggle',
'name' => 'status',
'header' => 'Status'
),
On My second Grid:
array(
'class'=>'yiiwheels.widgets.toggle.WhToggleColumn',
'toggleAction'=>'Users/toggle',
'name' => 'status',
'header' => 'Status'
),
Both grids has different ID's but on same page.But only second toggle action works not the first one. meanwhile i have setup my own way to do this.
$url = $this->createUrl('Trainerdetails/toggle');
Yii::app()->clientScript->registerScript('initStatus',
"$(document).on('change','#grid_cardio_workout .status',function() {
el = $(this);
$.ajax({
url:'$url',
data:{status: el.val(), id: el.data('id')},
success: function(response) {
$.fn.yiiGridView.update('grid_cardio_workout');
}
})
});",
CClientScript::POS_READY);
This is quite old... but did you find a solution?
I didnt end up with any solution yet but i have made a way to work out the machine.Client was on my head thats why i didnt made more research on this.Sorry but no solution yet.
Strange as the onchange seems correct:
$(document).on('click','#yw17 a.status_toggle', // see? is based on grid id
function() {
var th=this;
var afterToggle=function(){};
$.fn.yiiGridView.update('yw17', {
type:'POST',
url:$(this).attr('href'),
success:function(data) {
$.fn.yiiGridView.update('yw17');
afterToggle(true, data);
},
error:function(XHR){
afterToggle(false,XHR);
}
});
return false;
});
The only thing that should be updated is to unbind the method previous setting up the live click but the rest seems ok.
Hi, Am facing a issue with Toggle column grid widget.When i have a single grid on a page, its working fine but in another page where i have two different grids and both grids has toggle column but its works only on second grid but not on first grid, For debugging: i removed the second grid then the first grid toggle works fine,i think there is some problem with toggle column on multiple grids with same page.