How do I get a change in my tree model to be displayed?

2008-03-31 Thread David Leangen

Hi.

The ajax stuff is a bit new to me, so sorry if this is an obvious
question.

I'm trying to figure out how to get my change in my tree model to show
up on screen.

I want to be able to expand to and select a node from the tree based on
its value (determined elsewhere in the application).

I resolve the path of the node I want, grab any not-yet-resolved
children from the DB (my tree is large, so I only fetch my children as
required), and then I expand and select.

  final ITreeState treeState = getTreeState();
  final TreeNode[] path = node.getPath();
  for( final TreeNode nextNode : path )
  {
  treeState.selectNode( node, true );
  nodeExpanded( nextNode );
  nodeSelected( nextNode );
  }

  invalidateAll();


Maybe I do some unnecessary stuff above, I don't know. In any case,
after expanding and selecting the node in my model, the big thing for me
is to get that change to take effect.


Thanks for the help!

David




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How do I get a change in my tree model to be displayed?

2008-03-31 Thread Thomas Kappler
Hi,

first of all, in the first line of the loop, shouldn't node be nextNode?

Then, you're directly calling listener methods, which are supposed to
be callbacks, i.e., they are called by the framework when, and after,
a selection or expansion happens. You should use the methods offered
by ITreeState, such as expandNode(node) (as you do with selectNode).
Your listener methods will be called, if you added your listener to
the tree.

Cheers,
Thomas


   final ITreeState treeState = getTreeState();
   final TreeNode[] path = node.getPath();
   for( final TreeNode nextNode : path )
   {
   treeState.selectNode( node, true );
   nodeExpanded( nextNode );
   nodeSelected( nextNode );
   }

   invalidateAll();

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How do I get a change in my tree model to be displayed?

2008-03-31 Thread David Leangen

Beautiful.

Thank you!



On Mon, 2008-03-31 at 10:25 +0200, Thomas Kappler wrote:
 Hi,
 
 first of all, in the first line of the loop, shouldn't node be nextNode?
 
 Then, you're directly calling listener methods, which are supposed to
 be callbacks, i.e., they are called by the framework when, and after,
 a selection or expansion happens. You should use the methods offered
 by ITreeState, such as expandNode(node) (as you do with selectNode).
 Your listener methods will be called, if you added your listener to
 the tree.
 
 Cheers,
 Thomas
 
 
final ITreeState treeState = getTreeState();
final TreeNode[] path = node.getPath();
for( final TreeNode nextNode : path )
{
treeState.selectNode( node, true );
nodeExpanded( nextNode );
nodeSelected( nextNode );
}
 
invalidateAll();
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]