EasyUI Forum
December 14, 2024, 04:35:05 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: Datagrid custom resetSort changes emptyMsg  (Read 4156 times)
Wojak
Jr. Member
**
Posts: 62


View Profile WWW Email
« on: November 09, 2024, 05:07:05 PM »

I found a bug using a method from 2015 to reset sorting.
If my emptyMsg is set to anything but "" then it returns it to "".

Code:
$.extend($.fn.datagrid.methods, {
    resetSort: function (jq, param) {
        return jq.each(function () {
            var state = $.data(this, 'datagrid');
            var opts = state.options;
            var dc = state.dc;
            var header = dc.header1.add(dc.header2);
            header.find('div.datagrid-cell').removeClass('datagrid-sort-asc datagrid-sort-desc');
            param = param || {};
            opts.sortName = param.sortName;
            opts.sortOrder = param.sortOrder || 'asc';
            if (opts.sortName) {
                var names = opts.sortName.split(',');
                var orders = opts.sortOrder.split(',');
                for (var i = 0; i < names.length; i++) {
                    var col = $(this).datagrid('getColumnOption', names[i]);
                    header.find('div.' + col.cellClass).addClass('datagrid-sort-' + orders[i]);
                }
            }
            $(this).datagrid('reload');
        })
    }
});

After using this method also the emptyMsg doesn't disappear for datagrid view.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2279


View Profile Email
« Reply #1 on: November 10, 2024, 07:14:21 PM »

The 'emptyMsg' will display after loading empty rows. Please make sure if the data is empty after calling the 'reload' method.
Logged
Wojak
Jr. Member
**
Posts: 62


View Profile WWW Email
« Reply #2 on: November 11, 2024, 11:55:44 AM »

After refreshing the data is there, but 'emptyMsg' sometimes does not disappear. After it stays on the screen, I checked what 'emptyMsg' is in the settings and from text such as '123' it changes to ''. And after it stays on the screen and changes to '', it doesn't disappear after trying to refresh all the time
Logged
jarry
Administrator
Hero Member
*****
Posts: 2279


View Profile Email
« Reply #3 on: November 12, 2024, 07:40:18 PM »

Please look at this example https://www.jeasyui.com/demo/test/test21.html. It works fine.
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!