PDA

View Full Version : Treepanel how to get selected node without using a Ajax event or method ?



lordofthexings
May 25, 2010, 4:26 PM
I m recreating a grid based on the selection of a treepanel, how can I get the selected node of a TreePanel ?
I cant recreate the grid inside an Ajax method so I need to use the standard server side postback
I couldnt find an answer to such a simple thing in the whole site , please put some info

lordofthexings
May 25, 2010, 7:03 PM
I will use __doPostBack to do it until a cleaner way is posted ?


<ext:TreePanel ID="tvTables2" runat="server" MaxDataBindDepth="3" AutoGenerateDataBindings="true" EnableViewState ="false" ExpandDepth="2">

<Listeners>
<Click Handler="__doPostBack('gp',node.id);" />
</Listeners>
</ext:TreePanel>

Vladimir
May 26, 2010, 5:26 AM
Hi,


TreePanel1.getSelectionModel().getSelectedNode()


http://www.extjs.com/deploy/dev/docs/?class=Ext.tree.DefaultSelectionModel

lordofthexings
May 26, 2010, 11:16 AM
How can I raise the server side code with selection ?
A listener can not raise non ajax server side method?

I want to modify the below to a server side code instead of JavaScript add something like : OnSelectedNodeChanged="tvTables_SelectedNodeChanged"




<Listeners>
<Click Handler="__doPostBack('gp',node.id);" />
</Listeners>

Vladimir
May 26, 2010, 11:56 AM
Hi,

Use AjaxEvents and pass node id as extra parameter

lordofthexings
May 26, 2010, 12:02 PM
And IF I dont want any ajax what should I do
I just want to trigger server side code with a selection of the Tree,
because I m filling a grid programatically based on the Tree's selection