Refresh TreePanel on ItemClick

  1. #1

    Refresh TreePanel on ItemClick

    I want to refresh a Treepanel on ItemClick event. I already considered the Refresh Static Tree Example and the implementation works well, but when I call the same function on ItemClick, it doesn't seem to change anything.


    
    
    <script type="text/javascript">
    var clickNode = function (tree) {             //clickNode function
                App.direct.RefreshMenu({
                    success: function (node) {   
                        tree.setRootNode(node);
                    }
                });
            };
    </script>
    
    
    @(
    //create the panel and the treemenu inside the panel
     Html.X().TreePanel()
                .ID("TreePanel1")
                .Height(750)
                .Width(200)
                .Title("Files")
                .UseArrows(true)
                .AutoScroll(true)
                .AutoShow(true)
                .Mode(TreePanelMode.Remote)
                .RemoteEditUrl(Url.Action("RemoteEdit")) 
                .RemoteRemoveUrl(Url.Action("RemoteRemove"))
                .RemoteAppendUrl(Url.Action("RemoteAppend"))
                .RemoteInsertUrl(Url.Action("RemoteInsert"))
                .RemoteMoveUrl(Url.Action("RemoteMove"))
                .Editor(
                    Html.X().TextField()
                )
                .Listeners(l =>
                {
                    l.BeforeLoad.Fn = "nodeLoad"; 
                    l.ItemContextMenu.Fn = "showMenu";
                    l.ItemContextMenu.StopEvent = true;
                    l.RemoteActionRefusal.Handler = "Ext.Msg.alert('Action refusal', e.message);";
                    l.ItemClick.Handler = "clickNode(this.up('treepanel'));";    //calls clickNode on ItemClick, NOT WORKING
                })
                .View(
                    Html.X().TreeView()
                        .Plugins(
                            Html.X().TreeViewDragDrop().AllowLeafDrop(true).ContainerScroll(true)
                        )
                )
                .Tools(
                    Html.X().Tool()
                        .Type(ToolType.Refresh)
                        .Handler("clickNode(this.up('treepanel'));") // calls clickNode when pressing Refresh button, WORKING
                        .ToolTip("Refresh")
                )
                .Plugins(
                    Html.X().CellEditing()
                )
                .Root(Model)
        )
    Any suggestions?
    Last edited by R4auka; Dec 06, 2013 at 5:35 AM.
  2. #2
    Hello!

    Welcome to our forum!

    Please, wrap your code in CODE tag, read #3 here: http://forums.ext.net/showthread.php?10205

Similar Threads

  1. [CLOSED] bulid TreePanel dynamic, ItemClick is not work?
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 13, 2013, 5:08 AM
  2. Replies: 2
    Last Post: Aug 01, 2013, 2:06 AM
  3. [CLOSED] Custom atributes of Treepanel's nodes on Itemclick listener
    By profitsistemas in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 23, 2013, 11:12 AM
  4. [CLOSED] TreePanel itemClick DirectEvent
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 26, 2012, 4:53 AM
  5. Replies: 2
    Last Post: Jul 30, 2010, 12:37 AM

Tags for this Thread

Posting Permissions