Aug 17, 2016, 3:34 PM
Refresh Tree Panel content inside a DropDownField
Hi, I have this TreePanel inside a DropDownField
I fill it from code behind,but when i call the fill function in direct event it wont fill and refresh it again,with the new data.
thank You
I fill it from code behind,but when i call the fill function in direct event it wont fill and refresh it again,with the new data.
<ext:DropDownField
ID="Fieldclassplan"
runat="server"
FieldLabel=" التصنيÙ"
Editable="false"
Width="450" AutoPostBack="true"
LabelWidth="100"
TriggerIcon="SimpleStart"
Mode="ValueText" OnDataBinding="storeTree_DataBinding">
<Component>
<ext:TreePanel
ID="TreeFieldclassplan"
runat="server"
Icon="Accept"
Height="280"
Shadow="false"
Width="400"
UseArrows="true"
EnableDD="true"
AutoScroll="true"
ContainerScroll="true"
Animate="true"
HideHeaders="true"
RootVisible="false"
>
<Store>
<ext:TreeStore ID="TreeStore1" runat="server" >
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="NameEng" />
<ext:ModelField Name="parent" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<ColumnModel>
<Columns>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:TreeSelectionModel ID="TreeSelectionModel1" runat="server" Mode="Single">
<DirectEvents>
<SelectionChange>
<EventMask ShowMask="true" Msg="<% $LibSysResource:Docs.Loading%>" Target="CustomTarget" CustomTarget="={#{Fieldclassplan}.getEl()}" />
</SelectionChange>
</DirectEvents>
<Listeners>
<Select Handler="getTasks1(#{TreeFieldclassplan},#{txtClassPlanDorpdlstValue}); " />
</Listeners>
</ext:TreeSelectionModel>
</SelectionModel>
<Listeners>
<SelectionChange Handler="#{TreeFieldclassplan}.hide();">
</SelectionChange>
</Listeners>
</ext:TreePanel>
</Component>
<Listeners>
<Expand Handler="this.component.getRootNode().expand(true);#{TreeFieldclassplan}.show();" Single="true" Delay="10" />
</Listeners>
<DirectEvents>
</DirectEvents>
</ext:DropDownField>
Code Behind public void fillTreeClassplan(int Module)
{
//Ext.Net.Node rootclass = new Ext.Net.Node()
//{
// Text = " our class ",
//};
//TreeFieldclassplan.Root.Add(rootclass);
this.TreeFieldclassplan.Root.Clear();
var rootclass = new Node();
rootclass.Text = "Root";
// this.TreeFieldclassplan(rootclass.Children);
this.TreeFieldclassplan.Root.Add(rootclass);
// this.TreeFieldclassplan.ReRender();
var userClassPlanList = new Docs_UserClassPlanBLL().GetClassPlanByUser(userId, Module).Where(x=>x.parent == null);
// docs_us
// List<Docs_ClassPlan> MainClass = new Docs_ClassPlanBLL().FetchAll().Where(a => a.parent == null).ToList();
foreach (Docs_ClassPlan ucp in userClassPlanList)
{
Ext.Net.Node mainclassNode = new Ext.Net.Node()
{
Text = ucp.Name,
Icon = Icon.FolderStar,
NodeID = ucp.Id.ToString(),
CustomAttributes =
{
new ConfigItem()
{
Name="Id",
Value=ucp.Id.ToString()
},
new ConfigItem()
{
Name="Name",
Value=ucp.Name.ToString()
},
new ConfigItem()
{
Name="NameEng",
Value=ucp.NameEng
},
new ConfigItem(){
Name="parent",
Value=ucp.parent.ToString()
}
}
};
// ConfigItem
rootclass.Children.Add(mainclassNode);
fillChildClassplan(ucp, mainclassNode, Module);
rootclass.DataBind();
}
}
public void fillChildClassplan(Docs_ClassPlan mainclass1, Ext.Net.Node mainclassNode,int modulID)
{
var subPlace1 = new Docs_UserClassPlanBLL().GetByParentByUser(mainclass1.Id,userId,modulID);
//List<Docs_ClassPlan> subPlace1 = new Docs_ClassPlanBLL().GetByParent(mainclass1.Id);
foreach (var classplan in subPlace1)
{
var id = new Docs_ClassPlanBLL().GetAllParentBychild(classplan.Id);
Ext.Net.Node placeNode1 = new Ext.Net.Node()
{
Text = classplan.Name.ToString(),
NodeID = id.ToString(),
CustomAttributes =
{
new ConfigItem()
{
Name="Id",
Value=classplan.Id.ToString()
},
new ConfigItem()
{
Name="Name",
Value=classplan.Name.ToString()
},
new ConfigItem()
{
Name="NameEng",
Value=classplan.NameEng
},
new ConfigItem(){
Name="parent",
Value=classplan.parent.ToString()
}
}
};
mainclassNode.Children.Add(placeNode1);
fillChildClassplan(classplan, placeNode1, modulID);
}
// Fieldclassplan.Update();
}
thank You