I am using below link for sorting CGridview row,
http://www.yiiframework.com/wiki/238/creating-a-jqueryui-sortable-cgridview/
its working fine, but after grid update i cannot able to drag the grid row !
My code,
$('#basefilter-grid table').sortable({
forcePlaceholderSize: true,
forceHelperSize: true,
items: 'tr',
update : function () {
serial = $('#basefilter-grid table').sortable('serialize', {key: 'order[]', attribute: 'class'});
$.ajax({
'url': '" . $this->createUrl('baseContact/orderFilterRow') . "',
'type': 'post',
'data': serial,
'success': function(data){
$.fn.yiiGridView.update('basefilter-grid');
},
'error': function(request, status, error){
alert('We are unable to set the sort order at this time. Please try again in a few minutes.');
}
});
},
helper: fixHelper
}).disableSelection();
I have column 'order' after row dragged its gets updated, after grid refresh only updated value will be seen, so i need to update grid badly, can anyone say how to do this?
I think I know what the problem is. If you have any javascript or CSS added to the view where your grid lives, they may not be available after the ajaxUpdate
. I suggest you re-activate the plugins or extra JS functionality used for drag'n'drop.
For Example, if you want to use bootstrap tooltips you need to re-activate them after the ajaxUpdate:
'afterAjaxUpdate' => 'function(id,data) { $("[rel=\"tooltip\"]").tooltip(); }',