[CLOSED] How to get checked/selected nodes of a Treepanel/MultiSelectionModel from codebehind?

  1. #1

    [CLOSED] How to get checked/selected nodes of a Treepanel/MultiSelectionModel from codebehind?

    How can I get the SelectedNodes of a MultiSelectionModel?
    I have this page:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="uc_event._Default" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="rsm01" runat="server" ScriptMode="Debug" />
         <ext:Panel ID="def_pnlwuc01" runat="server" Layout="Fit" Title="UserControl" Icon="ApplicationViewDetail">
            <Items>
                <ext:DropDownField ID="ucde01_Cmb_CusBusRe" runat="server" Editable="false" Width="240" 
                    TriggerIcon="SimpleArrowDown" Mode="ValueText" >
                    <Component>
                        <ext:TreePanel ID="ucde01_Trp_CusBusRe" runat="server" Title="Kundenbeziehungen" Icon="Accept"
                            Height="300" Shadow="None" UseArrows="true" AutoScroll="true" Animate="true"
                            EnableDD="true" ContainerScroll="true" RootVisible="false">
                            <Root>
                                <ext:TreeNode>
                                    <Nodes>
                                        <ext:TreeNode Text="To Do" Icon="Folder">
                                            <Nodes>
                                                <ext:TreeNode Text="Go jogging" Leaf="true" Checked="False" />
                                                <ext:TreeNode Text="Take a nap" Leaf="true" Checked="False" />
                                                <ext:TreeNode Text="Clean house" Leaf="true" Checked="False" />
                                            </Nodes>
                                        </ext:TreeNode>
                                        <ext:TreeNode Text="Grocery List" Icon="Folder">
                                            <Nodes>
                                                <ext:TreeNode Text="Bananas" Leaf="true" Checked="False" />
                                                <ext:TreeNode Text="Milk" Leaf="true" Checked="False" />
                                                <ext:TreeNode Text="Cereal" Leaf="true" Checked="False" />
                                            </Nodes>
                                        </ext:TreeNode>
                                    </Nodes>
                                </ext:TreeNode>
                             </Root>
                            <SelectionModel>
                                <ext:MultiSelectionModel ID="ucde01_Msm_CusBusRe" runat="server" />
                            </SelectionModel>      
                         </ext:TreePanel>
                    </Component>
                    <Listeners>
                        <Expand Handler="this.component.getRootNode().expand(true);" Single="true" Delay="10" />
                    </Listeners>
                </ext:DropDownField>
                <ext:Button ID="Button1" runat="server" Icon="Disk">
                    <DirectEvents>
                        <Click OnEvent="det_tobbtnsave_Click" Timeout="300000">
                            <EventMask ShowMask="true" />
                        </Click>
                    </DirectEvents>
                    <ToolTips>
                        <ext:ToolTip ID="ToolTip1" runat="server" Html="Click on Save Button to read checked items" />
                    </ToolTips>
                </ext:Button>
            </Items>
         </ext:Panel>
        
        </form>
    </body>
    </html>
    and this codebehind code:
    Partial Public Class _Default
        Inherits System.Web.UI.Page
    
        Public Sub det_tobbtnsave_Click(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
            For i = 0 To ucde01_Msm_CusBusRe.SelectedNodes.Count - 1
    
            Next
        End Sub
    End Class
    and ucde01_Msm_CusBusRe.SelectedNodes is always NOTHING!

    Regards,
    Klaus
    Last edited by Daniil; Aug 12, 2010 at 2:08 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Selected nodes and checked are different states. SelectedNodes collection will be empty if you don't select nodes.
    To get checked nodes on the client side please use 'getChecked' method
    getChecked( [String attribute], [TreeNode startNode] ) : Array
    Retrieve an array of checked nodes, or an array of a specific attribute of checked nodes (e.g. 'id')
    Parameters:
    attribute : String
    (optional) Defaults to null (return the actual nodes)
    startNode : TreeNode
    (optional) The node to start from, defaults to the root
    Returns:
    Array
    We have added CheckedNodes collection to the TreePanel. Please update from SVN

Similar Threads

  1. Replies: 11
    Last Post: Jul 27, 2012, 2:22 PM
  2. [CLOSED] [1.0] TreePanel Checked
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 09, 2011, 5:02 PM
  3. Replies: 1
    Last Post: Nov 17, 2010, 12:42 PM
  4. Checked Nodes
    By fabiomarcos in forum 1.x Help
    Replies: 6
    Last Post: Jan 01, 2010, 12:29 PM
  5. TreePanel enumerate through checked nodes
    By PeterSam in forum 1.x Help
    Replies: 1
    Last Post: Feb 02, 2009, 5:25 PM

Posting Permissions