0
votes

I am a beginer in ext.net. I have created a simple tree with dynamic loading using proxy from out database.

@{
    Layout = null;
}

@{
    var thisPlugin = Model as IPlugin;
    if (thisPlugin == null)
    {
        throw new Exception("IPlugin expected");
    }

    var loadChildrenFunc = new Func<string>(() =>
    {
        string retVal = Url.Action("GetChildren/" + Url.Encode(thisPlugin.Id));
        return retVal;
    });

    var tree = Html.X().TreePanel().ID("FACILITY_TREE");
}

@(tree.Title("Facility tree")
        .Icon(Icon.Table)
        .Frame(true)
        .Height(450)
        .Width(300)
        .Border(false)
        .Store(Html.X().TreeStore().Proxy(Html.X().AjaxProxy().Url(loadChildrenFunc())))
        .Root(Html.X().Node().NodeID("0").Text("Facility objects tree")))

Treepanel succesfuly created and loads nodes. The problem I have is to acces tree to save it state. For example then expand/collapse nodes i need to call controller and save treeview state. So the question is how to solve it? Anoter, after click/double click i need to call JS function to modify some data on page. Please help. Thanks!

1

1 Answers

0
votes

i think you need to add a event listener.

like this

listeners: {
    collapse: function() {
        alert('collapsed');
    },
    expand: function() {
        alert('expand')
    },
    itemclick: function(s,r) {
            alert(r.data.text);
    }
}

hope this helps