You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by David Leangen <wi...@leangen.net> on 2008/03/31 10:10:02 UTC
How do I get a change in my tree model to be displayed?
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How do I get a change in my tree model to be displayed?
Posted by David Leangen <wi...@leangen.net>.
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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How do I get a change in my tree model to be displayed?
Posted by Thomas Kappler <tk...@googlemail.com>.
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org