EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on March 07, 2016, 09:47:15 PM



Title: onLoadSuccess always triggered when something happened to datagrid? [UNSOLVED]
Post by: aswzen on March 07, 2016, 09:47:15 PM
onLoadSuccess always triggered when something happened to datagrid, for example like
- sorting
- updating row
- etc

so is there any events listener to datagrid that called only one time when the datagrid loaded?

onLoadAtOnce() maybe or something?

Thank you in advance


Title: Re: onLoadSuccess always triggered when something happened to datagrid? [UNSOLVED]
Post by: jarry on March 08, 2016, 01:11:34 AM
Calling 'updateRow' method to update a row does not trigger the 'onLoadSuccess' event. When sorting the datagrid, the data will be sorted and re-loaded into the datagrid, the 'onLoadSuccess' event fires. You can use the 'onBeforeSortColumn' event to set a sorting flag that indicates the loading type.
Code:
$('#dg').datagrid({
remoteSort: false,
onBeforeSortColumn: function(){
$(this).datagrid('options').sorting = true;
},
onLoadSuccess: function(){
var opts = $(this).datagrid('options');
if (!opts.sorting){
console.log('normal loaded')
}
opts.sorting = false;
}
})