EasyUI Forum
May 06, 2024, 11:38:09 AM *
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 scrollTo problem when animation  (Read 2774 times)
WizPS
Jr. Member
**
Posts: 67


View Profile
« on: January 26, 2020, 04:06:16 PM »

Hi, I have a datagrid side by side with a Tree. Clicking a row in the grid expands, selects and scollTo that node in the Tree However selected Tree node becomes outside the window as the animation has not finished when scrollTo executes. The node becomes visible in the window for a split second but is moved down and outside the window as the animation continues. When animation is ready, the selected node is outside the window. If I turn animation off, it works fine. How can I make the scrollTo wait for the animation before start scrolling to the node so it becomes visible when done?
Code:
$('#dg').datagrid({
title: 'dg',
...
onSelect: function (index, row) {
var node = $('#tree').tree('find', row.Code);
$('#tree').tree('expandTo', node.target).tree('select', node.target);
$('#tree').tree('scrollTo', node.target);
}
});
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 28, 2020, 02:20:43 AM »

Please turn the 'animate' off before scrolling to the specified node, at finally turn the 'animate' on again.
Code:
var t = $('#tree');
var opts = t.tree('options');
opts.animate = false;
var node = t.tree('find', ...);
t.tree('expandTo', node.target);
t.tree('select', node.target);
t.tree('scrollTo', node.target);
opts.animate = true;
Logged
WizPS
Jr. Member
**
Posts: 67


View Profile
« Reply #2 on: January 28, 2020, 07:53:44 AM »

Works, yes. 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!