treepanel: no beforeremoteappend event triggered

  1. #1

    treepanel: no beforeremoteappend event triggered

    Hi,

    I am adding a node to a remote mode treepanel without an editor using the following code:

    node.appendChild(childNode);
    this.tree.appendChildRequest(childNode, 'append');

    the problem is that the beforeremoteappend event is not triggered and i need that one to pack some
    extra parameters that i need on the server side. how can i trigger this event? if that is not possible, how
    can i send additional information to the server side handler?

    thanks.
    Last edited by cajun; Apr 05, 2012 at 2:09 PM.
  2. #2
    Hi,

    I'm not sure what is "this" here?
    this.tree.appendChildRequest
    Generally, it works.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void RemoteAppend(object sender, RemoteAppendEventArgs e)
        {
            X.Msg.Alert("RemoteAppend", e.Text).Show();
        }
    </script>
    
    <!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>Ext.NET Example</title>
    
        <script type="text/javascript">
            var append = function (tree) {
                var root = tree.getRootNode();
    
                var child = root.appendChild({ 
                    text : "New node",
                    leaf : true
                });
    
                tree.appendChildRequest(child, "append");
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
             <ext:Button runat="server" Text="Append">
                <Listeners>
                    <Click Handler="append(TreePanel1);" />
                </Listeners>
            </ext:Button>
    
            <ext:TreePanel 
                ID="TreePanel1" 
                runat="server" 
                AutoHeight="true" 
                Mode="Remote" 
                OnRemoteAppend="RemoteAppend">
                <Root>
                    <ext:TreeNode Text="Root" Expanded="true" />
                </Root>
            </ext:TreePanel>
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,

    The problem is not the "remote append", but the "before remote append" event.

    The appendChildRequest method successfully triggers the remote append event, but doesn't
    trigger the BEFORE REMOTE APPEND event, which i need in order to add extra parameters for
    the server side "remote append" handler.

    The page i am trying to build is similar to this example: https://examples1.ext.net/#/Combinat.../Simple_Tasks/
    In this example you can see the pattern with the namespace and the treepanel reference and how the beforeremoteappend event is used to pass the "isFolder" parameter to the server side.

    main.js:
        beforeRemoteAppend : function (tree, node, params) {
            params["isFolder"] = node.attributes.isFolder;
        },
    TaskTree.cs InitLogic()
            this.Listeners.BeforeRemoteAppend.Fn = TasksTree.SCOPE + ".beforeRemoteAppend";
    Thanks for looking into this.

    Greetings,
    Last edited by cajun; Apr 10, 2012 at 7:50 AM.
  4. #4
    You should replace:
    tree.appendChildRequest(child, "append");
    with
    tree.appendChildRequest(child);
    The first parameter should be Boolean.

    "false" (default) means "append".

    "true" means "insert".
  5. #5
    Hi Daniil,

    i disagree. i think the tree.appendChildRequest childNode does not take boolean as first parameter but a tree node.
    is there some documentation about the js extensions that you have added on top of the ext js framework?

    thanks
  6. #6
    Quote Originally Posted by cajun View Post
    i disagree. i think the tree.appendChildRequest childNode does not take boolean as first parameter but a tree node.
    I meant the second parameter, just mistyped.

    Quote Originally Posted by cajun View Post
    is there some documentation about the js extensions that you have added on top of the ext js framework?
    Unfortunately, no.

Similar Threads

  1. Replies: 2
    Last Post: Apr 28, 2012, 8:34 AM
  2. [CLOSED] Event not triggered
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Apr 12, 2011, 9:12 PM
  3. [CLOSED] Event not being triggered on Chrome
    By alexp in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 30, 2009, 6:38 PM
  4. [CLOSED] javascript triggered window
    By alexp in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 12, 2009, 1:52 PM
  5. Listener events from dataField not triggered
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 27, 2009, 12:08 PM

Tags for this Thread

Posting Permissions