PDA

View Full Version : [CLOSED] HOW TO select a TreeNode of a TreePanel in code-behind - EXT.NET 2.4.x



PoloTheMonk
Mar 28, 2014, 5:20 PM
Hello,
I'm using EXT.NET 2.4.0.28408 and i'm building a tree in vb code-behind.

Here's the ext tree panel:

<ext:TreePanel ID="charTree" runat="server" Width="300"
Height="550"
Icon="BookOpen"
Title="Elements"
AutoScroll="true">
<Root>
</Root>
<BottomBar>
<ext:StatusBar ID="StatusBar1" runat="server" AutoClear="1500" />
</BottomBar>
<Listeners>
<ItemClick
Handler="#{StatusBar1}.setStatus({text: 'Selected Node: <b>' + record.data.text + '<br />', clear: false});"
/>
<ItemExpand
Handler="#{StatusBar1}.setStatus({text: 'Expanded Node: <b>' + item.data.text + '<br />', clear: false});"
Buffer="30"
/>
<ItemCollapse
Handler="#{StatusBar1}.setStatus({text: 'Collapsed Node: <b>' + item.data.text + '<br />', clear: false});"
Buffer="30"
/>
</Listeners>
</ext:TreePanel>

Here's the code-behind in vb.net:

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim root As New Ext.Net.Node
Dim children As String() = {"a", "b", "c"}

root.Text = "Alphabet"
charTree.Root.Add(root)

For Each c As String In children.ToList
Dim node As New Ext.Net.Node
node.Text = c
node.Icon = Icon.Add
node.Leaf = True
root.Children.Add(node)
Next
End Sub

The problem is that I'm trying to select a node in this tree panel, for example node with assigned text "b", and, simply, I'm not able to do it: how to?!?

Thank you in advance.

Daniil
Mar 28, 2014, 6:01 PM
Hi @PoloTheMonk,

I would use a TreeSelectionModel's SelectedRows.

PoloTheMonk
Apr 02, 2014, 2:05 PM
Hi Daniil,

could you please provide an example or a link to the use?

Cheers

Daniil
Apr 02, 2014, 3:04 PM
Similar to this:
http://examples2.ext.net/#/GridPanel/Selection_Models/Row_Selection/

Please see Page_Load.