EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: itay-g on June 18, 2014, 03:15:46 AM



Title: treegrid 'select' method scrolls to row
Post by: itay-g on June 18, 2014, 03:15:46 AM
Hi,
I'm trying to select a row in a tree-grid and i noticed that when i'm using the 'select' method, it scrolls to the row.
Is there a way to select a row without scrolling?

Thanks a lot


Title: Re: treegrid 'select' method scrolls to row
Post by: stworthy on June 21, 2014, 01:35:53 AM
Please try to use 'highlightRow' method instead.


Title: Re: treegrid 'select' method scrolls to row
Post by: itay-g on June 23, 2014, 01:04:38 AM
Hi,
highlightRow method doesn't help me because i need to select the row.
Is there any other solution?

Thanks,


Title: Re: treegrid 'select' method scrolls to row
Post by: itay-g on July 02, 2014, 03:17:26 AM
Hi,
Have you come up with a solution yet? I really need to solve this issue.

Thank you


Title: Re: treegrid 'select' method scrolls to row
Post by: stworthy on July 02, 2014, 04:42:34 AM
Please try to extend a new method to achieve this functionality.
Code:
$.extend($.fn.datagrid.methods, {
  selectRow2: function(jq, index){
    return jq.each(function(){
      var dc = $(this).data('datagrid').dc;
      var top = dc.body2.scrollTop();
      $(this).datagrid('selectRow', index);
      dc.body2.scrollTop(top);
    })
  }
})

Call 'selectRow2' method to select a special row without scrolling.
Code:
$('#tg').treegrid('selectRow2', 3);


Title: Re: treegrid 'select' method scrolls to row
Post by: itay-g on July 03, 2014, 06:30:56 AM
It works! Thank you