EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: gordis gmbh on October 24, 2016, 06:52:51 AM



Title: Datagrid sort: avoid double click
Post by: gordis gmbh 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?


Title: Re: Datagrid sort: avoid double click
Post by: jarry 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);
    }
})


Title: Re: Datagrid sort: avoid double click
Post by: gordis gmbh 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.