EasyUI Forum
May 17, 2024, 03:52:31 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: sorting a datagrid  (Read 3973 times)
korenanzo
Guest
« on: May 06, 2016, 01:27:50 AM »

Hi,

I am using data grid with scrollview, filter and cell editing plugins.


is it possible to maintain the current selected row (and  cell) when sorting a column in a datagrid?

There is the
onBeforeSortColumn event, where I can get the current row and save the row ID (can't use .index because it changes according to the sorting column)

but in the onSortColumn event  .datagrid('getRowIndex',n) returns always -1, so I can't get back to my row

and onAfterSortColumn does not exists

Thanks,

RIc
« Last Edit: May 06, 2016, 01:31:14 AM by korenanzo » Logged
korenanzo
Guest
« Reply #1 on: May 06, 2016, 02:28:45 AM »

Update:

in the onSortColumn
I used:
Code:
    var numpages= parseInt(o.datagrid('getData').total / o.datagrid('options').pageSize) +1;
  var index= -1;
for(var i=0; i<= numpages && index ==-1; i++)
{
o.datagrid('gotoPage',i); 
index= o.datagrid('getRowIndex',myId) ;
}

But if there are more than 1 page, index is always 499 (pageSize is 500)

so I think there's a bug
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!