EasyUI Forum
May 16, 2024, 05:13:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: tree-grid: scrolling to a selected row  (Read 7542 times)
itay-g
Newbie
*
Posts: 35


View Profile
« on: January 21, 2014, 05:42:41 AM »

Hey,
I have implemented an excel-like search along with tree-grid, where the user can enter text, and the first row that contains the text on any of its columns gets selected.
The problem is also want the scroll bar to 'jump' to the selected row.

I've tried using 'ScrollTo' but it doesn't seem to do the trick.  I've tried sending rowIndex and also sending the rowID but neither worked.

Is ScrollTo supposed to work with tree-grid? any other suggestions?

Thank you.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 21, 2014, 05:52:54 AM »

The method name is 'scrollTo' not 'ScrollTo'. When using in treegrid, you must pass the node id value to this method.
Code:
var id = 34;  // the node to scroll to
$('#tg').treegrid('scrollTo', id).treegrid('select', id);
Logged
itay-g
Newbie
*
Posts: 35


View Profile
« Reply #2 on: January 21, 2014, 06:12:43 AM »

Thank you for the very quick response! Smiley

However, the ScrollTo mistake was only on the post and in the actual code it was written well.
I didn't know about combining multiple calls like you did there, which is pretty sweet and I've changed it.

Turns out the problem wasnt even that - I was using a splitter and the scrollbar I was seeing was the splitter's scrollbar instead of the tree-grid's scrollbar

Should be fine now.
Thanks!
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!