EasyUI Forum
April 27, 2024, 08:47:08 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 Group Rows sorting  (Read 11616 times)
Rinat
Newbie
*
Posts: 31


View Profile
« on: April 01, 2015, 05:10:11 PM »

Hello!
Can I sort table by group field?

Code:
    $('#table').datagrid({
    groupField:'numout',
            groupFormatter:function(value,rows)
            {
                return value + rows.length + '';
            },
});
});

return
Quote
2
 - items
 - items
 - items
1
 - items
 - items
 - items
3
 -items
 - items
 -items


I would like to

Quote
1
 - items
 - items
 - items
2
 - items
 - items
 - items
3
 -items
 - items
 -items
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 01, 2015, 05:42:09 PM »

You can call 'sort' method to sort the special field.
Code:
$('#table').datagrid('sort', {
  sortName: 'numout',
  sortOrder: 'asc'
});
Logged
Rinat
Newbie
*
Posts: 31


View Profile
« Reply #2 on: April 02, 2015, 12:21:55 PM »

Sory, but it is not work
14
9
16
1
9
4
20
....
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: April 02, 2015, 07:09:27 PM »

Please take a look at this example http://jsfiddle.net/dr8jued4/. It works fine.
Logged
Rinat
Newbie
*
Posts: 31


View Profile
« Reply #4 on: April 03, 2015, 05:11:42 AM »

Thanks! Yes, it is work.
 But in my app it is not sorting by natural sort algoritm Sad


« Last Edit: April 03, 2015, 05:39:41 AM by Rinat » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: April 05, 2015, 03:31:19 AM »

Please try to custom the 'sorter' function for your field. The updated example below shows how to achieve this functionality.
http://jsfiddle.net/dr8jued4/1/
Logged
Rinat
Newbie
*
Posts: 31


View Profile
« Reply #6 on: April 06, 2015, 07:26:51 AM »

Thanks! It's work!
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!