Hi!
Is it possible to allow only one selection on WebTree? I have a pretty simple hierarchical data that needs to be shown to the user in tree-view manner (only 1 level deep). I also need to let the user to check any node, so checkboxes have been enabled. However, upon checking a node, I would like all other nodes to be un--checked. Is this possible?
I wrote the following code to iterate through the tree and un-check any node that is NOT the node that's being checked but the code reports "out of memory" error. It sounds like some sort of stack-overflow-type message and I think that for some reason the handler is getting called too many times. The tree is very small (just a few nodes in Level-0, and about 5-10 nodes in Level-1).
Can someone please point out what the problem is in my code below. Thanks for any help in advance!
{
var parents = tree.getNodes();
var children = parent.getChildNodes();
child.setChecked(false)
}
iam having UltraWebTree .. i want check boxes only with in children.then check boxes must act as an radio buttons...give me the detailed coding
thanks for advance
It works fine, but can u tell me, if i check a parent node all child node should check and vise varsa in the same function(checkbox working as a radio button).
Thanks in advance
Sharan
HI,
Well an easy way to accomplish this would be to use a hidden field on the form. when a node is checked. check this hidden field. If it has a checked node then retrieve it and uncheck it. Then update the hidden field with the new checked node
Basic algorithym
Hook up the client-side NodeChecked event
basic logic
get the hidden field.
if a node is present
get the node
node.setchecked(false)
add the new checked node to the hidden field.
Here is a help link to the CSOM:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WebTree_CSOM_Overview.html
Thank you very much for the great advise! You were aboslutely correct. All it needed was a check for the corrent status. If anyone is interested, here is the code that works just fine. Again, this is the code to make the WebTree have check-boxes enabled, but behavior is similar to radio-button gorup (i.e. only one chekckbox can be checked at any one time). The depth of the tree is irrelevant.
if (!bChecked)
var parent = parents;
if(child.getChecked())
I suspect you are getting the EOM error due to an infinite amount of NodeChecked events being thrown. You are listening to the NodeChecked event
and then doing
var child = children[m]; if(child.Id != nodeId)
so you aren't validating that the child is checked (and needs to be unchecked) you are just unchecking everything. This would probably end up throwing the event over and over as you keep starting the event over and over.