EasyUI Forum
April 26, 2024, 11:54:46 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Sorting fire onLoadSuccess event  (Read 5334 times)
Kevin
Jr. Member
**
Posts: 52


View Profile Email
« on: September 02, 2019, 07:54:24 AM »

Hi guys

Is there a reason why the onLoadSuccess event is fired whenever a column is clicked for sorting? Should this event only fire when the datagrid finishes loading data. After all there is the onSortColumn for this functionality. Is there a way to prevent this from happening?

Thanks
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 03, 2019, 12:36:00 AM »

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.
Code:
$('#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;
}
})
Logged
Kevin
Jr. Member
**
Posts: 52


View Profile Email
« Reply #2 on: September 03, 2019, 11:51:55 AM »

That's works. Thanks very much stworthy. Your answers are always spot on.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!