EasyUI Forum
September 15, 2025, 03:55:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid sort: avoid double click  (Read 6118 times)
gordis gmbh
Full Member
***
Posts: 103


View Profile Email
« on: October 24, 2016, 06:52:51 AM »

I have remote sort on all my datagrids. If a double-click on datagrids sortable column is made, the corresponding action is executed twice.

How can the double-click on datagrid header be interpreted to avoid the repeat action?
Or how can the second click of the double-click be ignored?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: October 24, 2016, 08:35:08 PM »

Please try this code to solve your issue.
Code:
$('#dg').datagrid({
    onBeforeSortColumn: function(){
        var opts = $(this).datagrid('options');
        if (opts.sorting){
            return false;
        }
        opts.sorting = true;
    },
    onSortColumn: function(){
        var opts = $(this).datagrid('options');
        setTimeout(function(){
            opts.sorting = false;
        },400);
    }
})
Logged
gordis gmbh
Full Member
***
Posts: 103


View Profile Email
« Reply #2 on: October 25, 2016, 07:27:05 AM »

Thankyou Jarry for the solution. It works just as desired.

I have now added the two events in extends block for both datagrid and edatagrid.

Can this be included as EasyUI Standard feature? On double click why would anyone want to trigger the sorting twice?

Please let me know your opinion.
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!