[CLOSED] Treepanel appendChild with Icon

  1. #1

    [CLOSED] Treepanel appendChild with Icon

    I have following code:
    function saveSearch(btn, text) {
            if (btn == 'ok')
                App.direct.SaveSearch(text, {
                    success: function (result) {
                        var store = App.TreePanel1.getStore();
                        node = store.getNodeById("savedSearches");
                        node.appendChild({
                            text: result,
                            leaf: true,
                        })
                    }
                });
        };
    This works, but I want to add node with icon: Icon.TableSave, and that newly created node is selected. Please help.
    Thanks.
    Last edited by Daniil; Sep 11, 2015 at 1:12 PM. Reason: [CLOSED]
  2. #2
    Hi @ingbabic,

    Please use iconCls: "#TableSave" in a node's config.

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var addNode = function () {
                var store = App.TreePanel1.getStore();
    
                node = store.getNodeById("TestNode");
                node.appendChild({
                    text: "New node",
                    iconCls: "#TableSave",
                    leaf: true
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Button runat="server" Text="Add node" Handler="addNode" />
    
            <ext:TreePanel ID="TreePanel1" runat="server">
                <Root>
                    <ext:Node Text="Root" Expanded="true">
                        <Children>
                            <ext:Node NodeID="TestNode" Text="Test Node" Expanded="true">
                                <Children>
                                    <ext:Node Text="Some node" Leaf="true" />
                                </Children>
                            </ext:Node>
                        </Children>
                    </ext:Node>
                </Root>
            </ext:TreePanel>
        </form>
    </body>
    </html>
    and that newly created node is selected.
    Please start a new forum thread.
    Last edited by Daniil; Sep 10, 2015 at 3:51 PM.
  3. #3
    Thanks Daniil

Similar Threads

  1. Replies: 3
    Last Post: Mar 02, 2015, 2:45 PM
  2. TreePanel remote mode AppendChild
    By Wellington Caetano in forum 1.x Help
    Replies: 0
    Last Post: Jun 16, 2011, 8:15 PM
  3. Replies: 5
    Last Post: Mar 23, 2011, 9:57 AM
  4. about Treenode.Appendchild's icon
    By helpme in forum 1.x Help
    Replies: 0
    Last Post: Mar 09, 2010, 7:57 AM

Tags for this Thread

Posting Permissions