View Full Version : [1.1.1] TreeNodeUI toggleCheck() issue
sjivan
10-18-2007, 11:27 PM
Ext version : 1.1.1
OS / Browser : All
TreeNodeUI's toggleCheck() visually changes the check state however it does not update the node's checked attribute and as a result TreePanels getChecked() does not correctly return the results from a programatic TreeNodeUI#toggleCheck() call.
You can take a look at this issue here :
http://gwt-ext.googlecode.com/svn/trunk/site/samples/Showcase/Showcase.html#checkboxTree
toggleCheck : function(value){
var cb = this.checkbox;
if(cb){
cb.checked = (value === undefined ? !cb.checked : value);
//sj this needs to be added to correctly update the nodes checked state
this.node.attributes.checked = cb.checked;
}
}
Animal
10-20-2007, 10:32 AM
I'd say getChecked was wrong really.
The attributes property is the initial config. The currently checked state is defined by the state of the checkbox.
There's also the problem of lazy loading.
getChecked goes through loaded nodes. If some aren't loaded, but still just part of their parent node's children attribute, then even if they were set up with checked:true, getChecked won't find them.
That's why this is so good in Ext 2: http://extjs.com/deploy/dev/docs/?class=Ext.tree.TreeLoader&member=preloadChildren
sjivan
10-20-2007, 02:53 PM
Thanks fo the pointer to Ext 2.0's preloadChildren config. Can the Ext 2.0 change log be updated to reflect this: http://extjs.com/forum/showthread.php?t=12866
I think getChecked() using the nodes attributes is correct (to handle non rendered nodes / checkboxes as you mentioned). So changing TreeNodeUI's toogleChecked method to also update the nodes checked attribute as I initially suggested seems appropriate. I agree that it might be confusing to a user if they call getChecked() in 1.1 and the node is not loaded, but the behaviour is consistent with Ext 2.0 which has the preloadChildren config. There's no other way around it in Ext 1.1 anyway.
This issue also seems to be in Ext 2.0 b1 as the getChecked() method only goes through the node's attributes and TreeNodeUI's toggleCheck() doesnt update the checked attribute.
It would be great if preloadChildren is added to Ext 1.1.x as well.
Thanks,
Sanjiv
Animal
10-21-2007, 03:30 AM
Go on Sanjiv! Upgrade to Ext 2.
You'll enjoy the challenge, and GWT-Ext will be so much better for it. I assume you've been staying up to date with its new design, capabilities, and performance gains?
sjivan
10-22-2007, 08:51 PM
Once I fully wrap up GWT-Ext / Ext 1.1.1, I plan on supporting Ext 2.0. I'm hoping to finish GWT-Ext / Ext 1.1.1 in a couple of weeks. Other than bug fixes, Grid Drag & Drop is main piece of functionality remaining.
I'm kinda aware of the new Ext 2.0 features / enhancements, but feel free to share the key improvements / design changes as you see it ( a few bullet points or a para ).
Thanks,
Sanjiv
sjivan
11-02-2007, 10:04 PM
This problem also exists in Ext 2.0. This portion of the code appears unchanged with Ext 2.0. Marc, do you want me to post in the Ext 2.0 area of the forum as well?
Sanjiv
mystix
11-03-2007, 12:30 AM
This problem also exists in Ext 2.0. This portion of the code appears unchanged with Ext 2.0. Marc, do you want me to post in the Ext 2.0 area of the forum as well?
Sanjiv
yes please, with a link back to this thread. thanks. :)
sjivan
02-09-2008, 10:10 PM
Go on Sanjiv! Upgrade to Ext 2.
You'll enjoy the challenge, and GWT-Ext will be so much better for it. I assume you've been staying up to date with its new design, capabilities, and performance gains?
It's finally here! Check out http://www.gwt-ext.com/demo
Would be great to hear your feedback.
Sanjiv
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.