[CLOSED] Tree Panel add Node and Start Editing

  1. #1

    [CLOSED] Tree Panel add Node and Start Editing

    Hi All,

    I want to add a node to a tree and directly start editing its name.
    In 1.3 it's OK ( using startEditing), but in 2.1 I cant do it.

    Also, I want to check if the entered name is duplicated. So how can I get all nodes, in order to get the names?

    Thanks.
    Last edited by Daniil; Dec 12, 2012 at 12:29 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Quote Originally Posted by FpNetWorth View Post
    I want to add a node to a tree and directly start editing its name.
    In 1.3 it's OK ( using startEditing), but in 2.1 I cant do it.
    I think you should use the startEdit method of an editing plugin.

    http://docs.sencha.com/ext-js/4-1/#!...thod-startEdit

    Quote Originally Posted by FpNetWorth View Post
    Also, I want to check if the entered name is duplicated. So how can I get all nodes, in order to get the names?
    The cascadeBy method is to "cascade" all nodes.
    http://docs.sencha.com/ext-js/4-1/#!...thod-cascadeBy
  3. #3
    Thanks a lot Daniil..
    Can you please provide me with an example.

    Thanks again!!
  4. #4
    Here you are.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var edit = function () {
                var tree = App.TreePanel1,
                    ep = tree.editingPlugin,
                    node = tree.getStore().getNodeById("Node1");
    
                ep.startEdit(node, tree.columns[0]);
            };
    
            var getText = function () {
                var tree = App.TreePanel1,
                    root = tree.getRootNode(),
                    text = [];
    
                root.cascadeBy(function (node) {
                    text.push(node.get("text"));
                });
    
                return text;
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TreePanel ID="TreePanel1" runat="server">
                <Root>
                    <ext:Node Text="Root" Expanded="true">
                        <Children>
                            <ext:Node NodeID="Node1" Text="Test" Leaf="true" />
                        </Children>
                    </ext:Node>
                </Root>
                <Editor>
                    <ext:TextField runat="server" />
                </Editor>
                <Plugins>
                    <ext:CellEditing runat="server" />
                </Plugins>
            </ext:TreePanel>
    
            <ext:Button runat="server" Text="Edit" Handler="edit" />
    
            <ext:Button runat="server" Text="Get text of all nodes" Handler="alert(Ext.encode(getText()));" />
        </form>
    </body>
    </html>
  5. #5
    Thanks a lot Daniil...

Similar Threads

  1. Replies: 1
    Last Post: Oct 26, 2012, 8:52 AM
  2. add node to tree panel
    By a_elsayed2010 in forum 1.x Help
    Replies: 0
    Last Post: Oct 17, 2010, 2:35 PM
  3. [CLOSED] Programatically start editing and set value of editor
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 25, 2010, 11:17 AM
  4. Selected Node - tree panel
    By filipator in forum 1.x Help
    Replies: 3
    Last Post: Mar 25, 2009, 2:58 PM
  5. [CLOSED] should remove for node in tree panel
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 24, 2009, 5:19 PM

Tags for this Thread

Posting Permissions