EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on May 06, 2016, 01:27:50 AM



Title: sorting a datagrid
Post by: korenanzo 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


Title: Re: sorting a datagrid
Post by: korenanzo 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