This is a migrated thread and some comments may be shown as answers.

[Solved] OnClientNodeClicking/ed and MultiSelect

2 Answers 143 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Peter Zolja
Top achievements
Rank 1
Peter Zolja asked on 12 Jun 2008, 10:16 PM
Hi,

Since one of the trees was generating too much ViewState I decided to disable it and work around it using JavaScript. I need to be able to keep track of which nodes are selected. As soon as a node is selected I notify the server via AJAX.

Here's my problem:
1) If I use OnNodeClicked, the event fires only for the first click. It does not fire for subsequent selections (i.e. when I hold down Ctrl to select other nodes).
2) If I use OnNodeClicking and call get_selectedNodes() I only get back the old nodes and not the currently selected node. I assume because the event fires before the node is actually marked as selected.

So, how can I work around this?

Thanks,
Peter.

2 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 16 Jun 2008, 04:25 PM
Hello Peter Zolja,

You can use the eventArgs.get_node() function to get a reference to the Node that is about to be selected (the rest of the selected Nodes you can obtain by calling the get_selectedNodes() of the TreeView).

All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Peter Zolja
Top achievements
Rank 1
answered on 16 Jun 2008, 04:31 PM
Thanks Simon, didn't think about doing it that way. Another way that seems to work is to use OnNodeClicking and launch a timer that does the processing. By the time the timer (I set it to 50ms) is launched all the nodes are properly selected and I can query the tree for selected nodes.
Tags
TreeView
Asked by
Peter Zolja
Top achievements
Rank 1
Answers by
Simon
Telerik team
Peter Zolja
Top achievements
Rank 1
Share this question
or