You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Live Nono <li...@gmail.com> on 2009/04/15 20:18:14 UTC

LinkTree : when using a refreshing model, expanding/collapsing nodes not working anymore

Hi

I've another issue with the LinkTree.

Up to recently, it was working all fine. I was creating the LinkTree this
way :
new LinkTree("tree", getTreeModel())

But then I wanted the model to be refreshed at each request.  I tried with
many refreshing models like for example new LinkTree("tree", new
LoadableTreeModel(rootId)) or new LinkTree("tree", new PropertyModel(this,
"TreeModel"))...

However, each time, the expanding/collapsing behavior doesn't work anymore.
When I click on the + or - nothing happens.

Any help regarding what to do/where to look is highly welcomed !

thanks in advance
nono

Re: LinkTree : when using a refreshing model, expanding/collapsing nodes not working anymore

Posted by CrocodileShoes <ma...@logica.com>.
Did you ever get anywhere with this?  I have the same problem where I refresh
the tree from the source data each time getObject() is called, that is, when
a user selects a node.  It just feels wrong but I can't get it to work any
other way.

I am persisting selected nodes by implementing my own ITreeState then
overriding isNodeSelected(Object node) to check for the node in the source
data.

I think this methodology is what is preventing the expansion and collapsing
of node to fail (I think it's actually working but the tree rebuild is
refreshing it immediately)

Cheers,
Mark


LiveNono wrote:
> 
> hi
> 
> I didn't manage to sleep this night so I did a quickstart project with my
> issue and then... realised how stupid I've been : when refreshing the tree
> I
> loose the data about what to open/close, hence my issue.
> 
> I don't know yet the solution I'll follow, hesitating between informing
> the
> user and refreshing the whole tree as soon as data behind change or keep
> track of the tree state in some wrappers around my data.
> 
> Time'll tell, and hopefully my brain will be faster next time :)
> 
> Side node : I'm once again amazed by the flexibility of wicket. It's
> really
> able to fit anyone needs.
> 
> The only "issue" with this tree, in my case, is that I find the code is a
> bit clumsy. First I affect the data to the nodes (using recursion), and
> then, when the linkTree is created, I assign some state to it according to
> some specific nodes I've just added (like which one will be first the
> first
> one, or to expand some nodes in order to have one pre selected), being
> kind
> of required to keep track of them in between.
> 
> thanks again
> nono
> 
> NB : I hope it doesn't seem like the mailing list is my teddy bear, even
> if
> the fact is that I spend a lot of time before asking trying to figure out
> by
> myself...
> 
> 2009/4/15 Live Nono <li...@gmail.com>
> 
>> Small extra precision : using
>> tree.getTreeState().expandAll()/collapseAll()
>> works fine...
>>
>> 2009/4/15 Live Nono <li...@gmail.com>
>>
>> Hi
>>>
>>> I've another issue with the LinkTree.
>>>
>>> Up to recently, it was working all fine. I was creating the LinkTree
>>> this
>>> way :
>>> new LinkTree("tree", getTreeModel())
>>>
>>> But then I wanted the model to be refreshed at each request.  I tried
>>> with
>>> many refreshing models like for example new LinkTree("tree", new
>>> LoadableTreeModel(rootId)) or new LinkTree("tree", new
>>> PropertyModel(this,
>>> "TreeModel"))...
>>>
>>> However, each time, the expanding/collapsing behavior doesn't work
>>> anymore. When I click on the + or - nothing happens.
>>>
>>> Any help regarding what to do/where to look is highly welcomed !
>>>
>>> thanks in advance
>>> nono
>>>
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/LinkTree-%3A-when-using-a-refreshing-model%2C-expanding-collapsing-nodes--not-working-anymore-tp23064351p24113088.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: LinkTree : when using a refreshing model, expanding/collapsing nodes not working anymore

Posted by Live Nono <li...@gmail.com>.
hi

I didn't manage to sleep this night so I did a quickstart project with my
issue and then... realised how stupid I've been : when refreshing the tree I
loose the data about what to open/close, hence my issue.

I don't know yet the solution I'll follow, hesitating between informing the
user and refreshing the whole tree as soon as data behind change or keep
track of the tree state in some wrappers around my data.

Time'll tell, and hopefully my brain will be faster next time :)

Side node : I'm once again amazed by the flexibility of wicket. It's really
able to fit anyone needs.

The only "issue" with this tree, in my case, is that I find the code is a
bit clumsy. First I affect the data to the nodes (using recursion), and
then, when the linkTree is created, I assign some state to it according to
some specific nodes I've just added (like which one will be first the first
one, or to expand some nodes in order to have one pre selected), being kind
of required to keep track of them in between.

thanks again
nono

NB : I hope it doesn't seem like the mailing list is my teddy bear, even if
the fact is that I spend a lot of time before asking trying to figure out by
myself...

2009/4/15 Live Nono <li...@gmail.com>

> Small extra precision : using tree.getTreeState().expandAll()/collapseAll()
> works fine...
>
> 2009/4/15 Live Nono <li...@gmail.com>
>
> Hi
>>
>> I've another issue with the LinkTree.
>>
>> Up to recently, it was working all fine. I was creating the LinkTree this
>> way :
>> new LinkTree("tree", getTreeModel())
>>
>> But then I wanted the model to be refreshed at each request.  I tried with
>> many refreshing models like for example new LinkTree("tree", new
>> LoadableTreeModel(rootId)) or new LinkTree("tree", new PropertyModel(this,
>> "TreeModel"))...
>>
>> However, each time, the expanding/collapsing behavior doesn't work
>> anymore. When I click on the + or - nothing happens.
>>
>> Any help regarding what to do/where to look is highly welcomed !
>>
>> thanks in advance
>> nono
>>
>
>

Re: LinkTree : when using a refreshing model, expanding/collapsing nodes not working anymore

Posted by Live Nono <li...@gmail.com>.
Small extra precision : using tree.getTreeState().expandAll()/collapseAll()
works fine...

2009/4/15 Live Nono <li...@gmail.com>

> Hi
>
> I've another issue with the LinkTree.
>
> Up to recently, it was working all fine. I was creating the LinkTree this
> way :
> new LinkTree("tree", getTreeModel())
>
> But then I wanted the model to be refreshed at each request.  I tried with
> many refreshing models like for example new LinkTree("tree", new
> LoadableTreeModel(rootId)) or new LinkTree("tree", new PropertyModel(this,
> "TreeModel"))...
>
> However, each time, the expanding/collapsing behavior doesn't work anymore.
> When I click on the + or - nothing happens.
>
> Any help regarding what to do/where to look is highly welcomed !
>
> thanks in advance
> nono
>