[CLOSED] [1.0] TreePanel add node at DirectEvent

  1. #1

    [CLOSED] [1.0] TreePanel add node at DirectEvent

    Hi Vlad,

    I updated to the new version, but I have still problems adding a Node to a TreePanel in code behind DirectEvent.

    The code executes well, the new item - menu item - is inserted into the DB but when I tried with the following code, sometimes it updates the Tree so that I can see the new node and sometimes not!

    I can't understand how to solve it.

    
    <ext:TreePanel ID="TreePanelPortale" 
                                    BodyStyle="background-color:#F4F4F4; padding:2px;"
                                    Mode="Remote"
                                    UseArrows="true" 
                                    runat="server" 
                                    Width="200" 
                                    Border="false" 
                                    AutoScroll="true"
                                    Title="Gestione Menu" 
                                    Animate="true"
                                    EnableDD="true" 
                                    AllowLeafDrop="false"
                                    OnRemoteMove="TreePanelPortale_RemoteMove">
                                    <Loader>
                                        <ext:PageTreeLoader OnNodeLoad="NodeLoad">
                                        </ext:PageTreeLoader>
                                    </Loader>
                                    <Root>
                                        <ext:AsyncTreeNode NodeID="0" Text="Portale" />
                                    </Root>
                                    <Listeners>
                                        <BeforeNodeDrop Fn="beforeDrop" />
                                        <ContextMenu Handler="#{cmenu}.node = node; node.select(); #{cmenu}.showAt(e.getPoint());" />
                                    </Listeners>
                                    <DirectEvents>
                                        <Click OnEvent="TreePanelPortale_Click">
                                            <ExtraParams>
                                                <ext:Parameter Mode="Raw" Value="node.id" Name="PRM_NodeId">
                                                </ext:Parameter>
                                                <ext:Parameter Mode="Raw" Value="node.href" Name="PRM_NodeHref">
                                                </ext:Parameter>
                                            </ExtraParams>
                                        </Click>
                                    </DirectEvents>
                                </ext:TreePanel>
    In DirectEvent triggered by a button in the page - it retieves the textbox value for the new node to be added

    
    // insert new item in the db
    ...
    
    string _nodeId = (_mItem.ParentNode != null) ? _mItem.ParentNode.Oid.ToString() : "0";
    this.TreePanelPortale.AddScript("{0}.getNodeById('{1}').reload();", this.TreePanelPortale.ClientID, _nodeId);
    Thanx

    Matteo
  2. #2

    RE: [CLOSED] [1.0] TreePanel add node at DirectEvent

    Hi,

    I think the problem that you try to reload the node until remote move action as complete. Try to use the following listener for the tree
    <RemoteActionSuccess Handler="if(action == 'move'){this.getNodeById(node.id).reload();}" />
  3. #3

    RE: [CLOSED] [1.0] TreePanel add node at DirectEvent

    Hi Vlad,

    I tried the code you suggest but, good to know, if related to the 'Move' action, in my case the action - event -
    works pretty good. In my scenario the issue is related to seeing the new added node in the tree menu.

    I tried: if(action == 'append') or if(action == 'insert') without success, I don't think is my case.

    Please, check image in attach, hope is more clear.

    Thanx

    Matteo


  4. #4

    RE: [CLOSED] [1.0] TreePanel add node at DirectEvent

    Hi Vlad,

    sorry, please mark as solved, it was a bug in my persistent collection items. Ext.Net is ok.

    Matteo

Similar Threads

  1. [CLOSED] TreePanel Node and IconCls
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 10, 2014, 9:21 PM
  2. How to get Node by id in treepanel 2.0?
    By tms2003@126.com in forum 2.x Help
    Replies: 1
    Last Post: Apr 03, 2012, 3:01 PM
  3. [CLOSED] Delete treepanel node
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 05, 2011, 8:30 PM
  4. Treepanel Node
    By lindgrenm in forum 1.x Help
    Replies: 0
    Last Post: Feb 10, 2010, 3:08 PM
  5. TreePanel:Copying from one node to another node using drag and drop
    By eighty20 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 25, 2009, 7:48 AM

Posting Permissions