The sorting action will cause the sorted data to be loaded again. This will trigger the 'onLoadSuccess' event. If you want to identify the sorting action, add a flag before sorting and remote it after loading data.
$('#dg').datagrid({
remoteSort: false,
onBeforeSortColumn: function(){
var opts = $(this).datagrid('options');
opts.isSorting = true;
},
onSortColumn: function(){
//...
},
onLoadSuccess: function(data){
var opts = $(this).datagrid('options');
opts.isSorting = false;
}
})