PDA

View Full Version : [CLOSED] How to reconfigure TreePanel using JavaScript



Svr77
May 30, 2013, 2:24 PM
Hello All,

Can you post me an example or at least guidance about a good approach how to reconfigure a tree panel using JavaScript? I tired to search over the internet, but only found that there was reconfigure method in Ext.tree.panel which is no longer exists. All that I need to write a method on client side which would remove all columns and replace it with new fields/columns and data coming from the server.

Thank you in advance!

Alexander

Daniil
May 30, 2013, 4:17 PM
Hi @Svr77,

A TreePanel does have the reconfigure method and it appears to be working.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<script>
var reconfigure = function () {
App.TreePanel1.reconfigure(null, [{
xtype: "treecolumn",
dataIndex: "text"
}, {
dataIndex: "text"
}]);
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Reconfigure" Handler="reconfigure" />

<ext:TreePanel ID="TreePanel1" runat="server">
<Root>
<ext:Node Text="Root (level 0)" Expanded="true">
<Children>
<ext:Node Text="Node1 (level 1)" Expanded="true">
<Children>
<ext:Node Text="Node1 (level 2)" Expanded="true">
<Children>
<ext:Node Text="Node1 (level 3)" Leaf="true" />
<ext:Node Text="Node2 (level 3)" Leaf="true" />
</Children>
</ext:Node>
</Children>
</ext:Node>
<ext:Node Text="Node2 (level 1)" Expanded="true">
<Children>
<ext:Node Text="Node1 (level 2)" Expanded="true">
<Children>
<ext:Node Text="Node1 (level 3)" Leaf="true" />
<ext:Node Text="Node2 (level 3)" Leaf="true" />
</Children>
</ext:Node>
</Children>
</ext:Node>
</Children>
</ext:Node>
</Root>
</ext:TreePanel>
</form>
</body>
</html>


I would expect it should also work if pass a TreeStore instance as the first parameter.

Daniil
May 30, 2013, 4:25 PM
Also you might be interested to look at these examples.
http://examples2.ext.net/#/GridPanel/Data_Presentation/Meta_config/
http://examples2.ext.net/#/GridPanel/Data_Presentation/Meta_config_with_handler/