Dec 30, 2008, 12:39 AM
How to refresh a tree panel by Listern or other method?
The tree node is generated by code behind
<ext:TreePanel ID="treePanel" runat="server" Icon="Anchor" BodyBorder="false" Title="????"
AutoScroll="true" Width="250" Collapsed="False" CollapseFirst="True" HideParent="False"
RootVisible="False" BodyStyle="padding-left:10px">
<Tools>
<%--call RefreshMenu method to refresh it , but i failed....--%>
<ext:Tool Type="Refresh" Qtip="Refresh" Handler="Coolite.AjaxMethods.CountMenu()" />
</Tools>
</ext:TreePanel>
code behind:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack && !Ext.Ext.IsAjaxRequest)
{
BindTreeMenu(null, null);
}
}
[AjaxMethod]
public void BindTreeMenu(string nenuKey, Ext.TreeNode root)
{
// some bind code for treePanel
}
[AjaxMethod]
public void RefreshMenu()
{
//Ext.ScriptManager sm = (Ext.ScriptManager)this.Master.FindControl("scriptManager");
//this.scriptManager.AddScript("alert('Nodes count: {0}');", this.treePanel.Root.Count);
this.treePanel.Root.Clear();
//call Reload() to refresh ,but a script error will occured. Anyone have some solutions for this??
this.treePanel.Reload();
}