[CLOSED] Read all checked nodes in treepanel by code_behind

  1. #1

    [CLOSED] Read all checked nodes in treepanel by code_behind

    Hello


    How could I read all the checkbox clicked in the treeview example
    https://examples2.ext.net/#/TreePane...nced/TreeGrid/


    Already tried various methods and failed.

    Tks

    Ulisses
    Last edited by Daniil; Dec 11, 2014 at 7:41 AM. Reason: [CLOSED]
  2. #2
    Hi @ucaneto,

    Probably, you mean the checkboxes in a CheckColumn. If so, this information is not sent to server automatically. You should send it manually via a request's parameters, i.e. a DirectEvent's ExtraParams or a DirectMethod's parameters.

    If you use a Node's Checked as here
    https://examples2.ext.net/#/TreePane...heckbox_Nodes/

    Then the checked nodes are automatically submitted to the server and you are able to access it via:
    this.TreePanel1.CheckedNodes
  3. #3
    Hi

    I put the code below
                                      <DirectEvents>
                                             <CheckChange OnEvent = "checkChange">
                                                 <ExtraParams>
                                                     <ext: Parameter Name = "checked" Value = "checked" Mode = "Raw" />
                                                 </ ExtraParams>
                                             </ CheckChange>
                                         </ DirectEvents>
    and can return if clicked or not, what I need is to know the complete treepanel line below is a picture that shows what I need.


    As the precise image that returns the data (cidade,true);
    or the need to get the text node, plus the check value.

    I'm sorry if I can not express well what I need, is that my English is basic.

    Tks

    Ulisses
    Attached Thumbnails Click image for larger version. 

Name:	ima1.fw.jpg 
Views:	32 
Size:	38.9 KB 
ID:	16581  
    Last edited by ucaneto; Nov 24, 2014 at 10:53 PM.
  4. #4
    This example should help.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void CheckColumn_CheckChange(object sender, DirectEventArgs e)
        {
            SubmittedNode node = JSON.Deserialize<SubmittedNode>(e.ExtraParams["node"], new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver());
            X.Msg.Alert("CheckColumn_CheckChange", node.Text + " " + node.Attributes["actual"]).Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TreePanel runat="server" Width="300">
                <Fields>
                    <ext:ModelField Name="actual" />
                </Fields>
                <ColumnModel>
                    <Columns>
                        <ext:TreeColumn runat="server" Text="Text" DataIndex="text" Flex="1" />
                        <ext:CheckColumn runat="server" Text="Actual" DataIndex="actual" Editable="true">
                            <DirectEvents>
                                <CheckChange OnEvent="CheckColumn_CheckChange">
                                    <ExtraParams>
                                        <ext:Parameter Name="node" Value="this.grid.convertToSubmitNode(record)" Mode="Raw" />
                                    </ExtraParams>
                                </CheckChange>
                            </DirectEvents>
                        </ext:CheckColumn>
                    </Columns>
                </ColumnModel>
                <Root>
                    <ext:Node Text="Root (level 0)" Expanded="true">
                        <Children>
                            <ext:Node Text="Node1 (level 1)" Expanded="true">
                                <Children>
                                    <ext:Node Text="Node1 (level 2)" Expanded="true">
                                        <Children>
                                            <ext:Node Text="Node1 (level 3)" Leaf="true" />
                                            <ext:Node Text="Node2 (level 3)" Leaf="true" />
                                        </Children>
                                    </ext:Node>
                                </Children>
                            </ext:Node>
                            <ext:Node Text="Node2 (level 1)" Expanded="true">
                                <Children>
                                    <ext:Node Text="Node1 (level 2)" Expanded="true">
                                        <Children>
                                            <ext:Node Text="Node1 (level 3)" Leaf="true" />
                                            <ext:Node Text="Node2 (level 3)" Leaf="true" />
                                        </Children>
                                    </ext:Node>
                                </Children>
                            </ext:Node>
                        </Children>
                    </ext:Node>
                </Root>
            </ext:TreePanel>
        </form>
    </body>
    </html>
  5. #5
    Hi Daniil


    Actually what I want is to click on a button and go all the nodes of treepanel and check which were clicked.


    How can I do this?


    I have tried many ways, the way you went I caught the second you click actually the User can click on each and when you click for example on a save button it will read all the nodes and check which were clicked.


    grateful

    Ulisses
  6. #6
    It looks you just need to submit all the nodes in one click.

    Please take a look at this example, the "Simple Submit" button and the SubmitNodes method.
    https://examples2.ext.net/#/TreePanel/Basic/Submit

Similar Threads

  1. [CLOSED] Treepanel drag drop with multiple checked nodes
    By jchau in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 12, 2013, 3:34 PM
  2. [CLOSED] Get Checked nodes from TreePanel. js
    By Django in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 23, 2013, 5:21 PM
  3. Replies: 2
    Last Post: Jul 15, 2013, 4:06 AM
  4. Replies: 11
    Last Post: Sep 27, 2012, 10:04 PM
  5. TreePanel enumerate through checked nodes
    By PeterSam in forum 1.x Help
    Replies: 1
    Last Post: Feb 02, 2009, 5:25 PM

Tags for this Thread

Posting Permissions