Dec 05, 2013, 1:55 PM
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.