EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: BinaryCode on March 02, 2014, 08:29:26 PM



Title: Unable highlightRow for second page and further
Post by: BinaryCode on March 02, 2014, 08:29:26 PM
Hello,

I try to load data to datagrid as client side mode with options:
 data-options="
               rownumbers:true,
               singleSelect:true,
               autoRowHeight:false,
               pagination:true,
               pageSize:50,fit:true, pageList:[10,50,100]"

i try to move next page using this script:
 
gridTripReport.datagrid('scrollTo', tripIndex);
gridTripReport.datagrid('highlightRow', tripIndex);

those success execute and row highlighted, then i move to next page success execute

pageNumber++;
pagerGridTripReport = gridTripReport.datagrid("getPager");
pagerGridTripReport.pagination('select', pageNumber);

but problem happend when highlightRow for second and further page:

gridTripReport.datagrid('scrollTo', tripIndex);
gridTripReport.datagrid('highlightRow', tripIndex);

Above script doesnot highlight Row,

What the main problem?

TIA





Title: Re: Unable highlightRow for second page and further
Post by: stworthy on March 03, 2014, 02:17:00 AM
When calling 'select' method to move page to next, the data is not loaded immediately. You are 'highlightRow' an un-existing row, this is why errors happen. To solve this issue, please call 'highlightRow' method after loading data successfully.
Code:
$('#dg').datagrid({
  onLoadSuccess: function(){
    $(this).datagrid('scrollTo',...).datagrid('highlightRow',...);
  }
});