if i remember correctly setChecked functions only if the node is not
rendered
after you have to use toggleCheck
so the correct code is:
node.eachChild(new NodeTraversalCallback() {
public boolean execute(Node node) {
((TreeNode)node).getUI().toggleCheck(true);//true if you want
the node to be checked
}
});
i have tried it myself and functions correctly ;)...
bye Patrizio
2009/7/7 Roundcrisis <[email protected]>
> Hi Patrizio:
> Thanks for the answer however I do need to do the cascade onCheckChange
> because I need to set the child of the node to whatever the current checked
> value of the parent is
> I tried this
>
> public void onCheckChange(TreeNode node, final boolean checked) {
>
> for (Node temp: node.getChildNodes()){
> ((TreeNode)temp).setChecked(checked);
> System.out.println(temp.getPath());
> }
> }
>
> and that does print the right nodes to console , however it doesnt check :(
>
>
> so then I tried the cascade that I posted earlier and on that you hit the
> problem that cascadeing does transverse the whole tree,
> however I thought the setChecked would work, and it doesnt.
> So I tried to call execute of the cascade with a TreeNode as parameter, but
> you cant, because of the cascade interface sets the parameter to be a Node .
>
>
>
> It seems like this is a bug
> If anyone knows a work around to set the child of a node as checked I would
> be very thankful :D
>
> Andrea
>
>
>
>
> On Mon, Jul 6, 2009 at 10:13 PM, Patrizio De Michele
> <[email protected]>wrote:
>
>> i believe that your error is that you have inserted the call of the
>> cascade
>> inside the onCheckChange method that will be called
>> a very large number of times...infact every node that will
>> be checked will call the onCheckChange....and cascading
>> on all of its childs...maybe you don't see changes to the checks
>> 'cause you have an even number of nodes...
>> bye Pat
>>
>> 2009/7/6 Andrea <[email protected]>
>>
>>
>>> Hi all:
>>>
>>> I was trying to do something like
>>>
>>> public void onCheckChange(TreeNode node, final boolean checked)
>>> {
>>> rootNode.cascade(new NodeTraversalCallback() {
>>> public boolean execute(TreeNode node) {
>>> node.setChecked(checked);
>>> return true;
>>> }
>>> }
>>> }
>>>
>>> now, that does NOT work, I tried in several different ways, like
>>> trying to get
>>>
>>> public boolean execute(Node node) {
>>>
>>> and casting the node up so I can do a set checked but no joy , anyone
>>> managed to make this work?
>>> Cheers
>>>
>>> Andrea
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---