[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 2: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 4:51 PM.
  3. #3
    Thanks Daniil

Similar Threads

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

Tags for this Thread

Posting Permissions