EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sectioni on November 20, 2017, 09:59:36 AM



Title: Override onSelectPage for datagrid
Post by: sectioni on November 20, 2017, 09:59:36 AM
Hi,

I want to do that when i change page, the table will auto-scoll to the top.

I tried something like this but no luck:

 $.extend($.fn.pagination.defaults, {
     onSelectPage: function (pageNumber, pageSize) { $(this).datagrid("scrollTo", 0); }
 });


Title: Re: Override onSelectPage for datagrid
Post by: jarry on November 21, 2017, 01:46:51 AM
Try this code:
Code:
$('#dg').datagrid({
  onLoadSuccess: function(data){
    if (data.rows.length){
      $(this).datagrid('scrollTo', 0);
    }
  }
})


Title: Re: Override onSelectPage for datagrid
Post by: sectioni on November 22, 2017, 02:58:42 AM
That one I already knew :)

I have 30 datagrids in my system..