EasyUI Forum
April 27, 2024, 01:51:04 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: Sort column properties  (Read 6232 times)
varonica
Full Member
***
Posts: 106


View Profile
« on: September 10, 2014, 02:34:01 AM »

I'm not sure if i miss it but all i want is to make datagrid sort(local sort) when data load successfully. Please help me guys!! Sad Sad
Logged
Kevin
Jr. Member
**
Posts: 52


View Profile Email
« Reply #1 on: September 15, 2014, 04:56:03 PM »

Sorting on the server is ideal. If you still need to sort the data, you can use the onLoadSuccess event. Then you could call the sort method. For example;
Code:
$('#dg').datagrid({
   onLoadSuccess: function(){
      $('#dg').datagrid('sort', {
         sortName: 'date',
         sortOrder: 'desc'
      });
   },
   fit: true,
   nowrap: true,
   striped: true,
   collapsible: true,
   columns: [[
      { field: 'date', title: 'Date', width: 120, sortable: true, sorter: function (a, b) { return (a > b ? 1 : -1); } },
      { field: 'name', title: 'Name', width: 120, sortable: true, sorter: function (a, b) { return (a > b ? 1 : -1); }}
  ]]
});


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!