Refresh Tree Panel content inside a DropDownField

  1. #1

    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.


    <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
  2. #2
    you need to reload tree panel first then the combo box and thanks for nothing

Similar Threads

  1. [CLOSED] Refresh Tree Panel
    By S.KARATHANASIS in forum 2.x Premium Help
    Replies: 2
    Last Post: Sep 17, 2013, 3:04 PM
  2. Replies: 2
    Last Post: Aug 30, 2013, 3:49 PM
  3. Refresh ext:Panel content
    By reiben in forum 1.x Help
    Replies: 3
    Last Post: Mar 29, 2011, 6:01 PM
  4. Replies: 8
    Last Post: May 28, 2009, 9:18 PM
  5. Replies: 3
    Last Post: Jan 03, 2009, 11:41 PM

Tags for this Thread

Posting Permissions