[CLOSED] Buid TreeGrid in Direct Event

  1. #1

    [CLOSED] Buid TreeGrid in Direct Event

    hi guys.

    I am try to build treegrid when the User click on button. the page will call Direct event.

    The tree will build fine when I build it in the page onload but if I try to do the samething in Direct event nothing will happen.


    Thank you

     
     
     
    <ext:ButtonID="btnSubmit"runat="server"Icon="Magnifier"Text="Submit">
    <DirectEvents>
    <ClickOnEvent="GetManagersData">
    <EventMaskShowMask="true"/>
    </Click>
    </DirectEvents>
    </ext:Button>
     
     
    <ext:TreeGridrunat="server"Width="780"ID="TrManagers"Height="500">
    <Columns>
    <ext:TreeGridColumnHeader="Manager"DataIndex="ChildManagerNameID"Width="250"/> 
    <ext:TreeGridColumnHeader="Pool USD"DataIndex="PoolUSD"Width="80"Align="Right"/> 
    <ext:TreeGridColumnHeader="Pool Allocated USD"DataIndex="PoolAllocatedUS"Width="100"Align="Right"/> 
    <ext:TreeGridColumnHeader="Pool Remaining USD"DataIndex="PoolRemainingUSD"Width="100"Align="Right"/> 
    <ext:TreeGridColumnHeader="Eligible Employees"DataIndex="EligibleEmployee"Width="110"Align="Center"/> 
    <ext:TreeGridColumnHeader="Employees Planned"DataIndex="PlanedEmployee"Width="110"Align="Center"/> 
    <ext:TreeGridColumnHeader="% Employees Planned"DataIndex="PercentPlaned"Width="110"Align="Center"/> 
    </Columns>
    </ext:TreeGrid>



    protectedvoid Page_Load(object sender, EventArgs e)
    {
    if (!X.IsAjaxRequest)
    {
              BuildTreee();  // This work fine
     
    }
    }
     
     
     
    protectedvoid GetManagersData(object sender, DirectEventArgs e)
    {
     
            BuildTreee()  // This doesn't work
    }
    privatevoid BuildTreee()
    {
    Ext.Net.TreeNode root = new Ext.Net.TreeNode();
    IList<GetBonusSummary> summarys = SummaryObjects.GetBonusSummary(newGuid("C31B2FB4-F583-4D0A-9C67-595FF82588EC"), "111");
    List<Summary> Summarys = Summary.BuildBonusSummary(summarys);
    List<Summary> lst = Summarys.Where(n => n.ChildManger == 111).ToList();
    Summary lst1 = (from s in Summarys.Where(n => n.ChildManger == 111)
    select s).First();
    TrManagers.Root.Add(root);
    Ext.Net.TreeNode ChildNode = AddOneNode(lst1);
    root.Nodes.Add(ChildNode);
    BuildNodes(Summarys, ChildNode);
    BuildNodes(Summarys, ChildNode);
    }
     
     
     
     
     
    private Ext.Net.TreeNode AddOneNode(Summary node)
    {
     
    Ext.Net.TreeNode treeNode = new Ext.Net.TreeNode();
     
    treeNode.NodeID = node.ChildManger.ToString();
    if (node.NumberOFChildren == 1)
    {
    treeNode.Leaf = true;
    }
    else
    {
    treeNode.IconCls = "FolderGo";
    treeNode.Leaf = false;
    }
    treeNode.CustomAttributes.Add(newConfigItem { Name = "ChildManagerNameID", Value = node.ChildManagerNameID.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "PoolUSD", Value = node.PoolUSD.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "PoolAllocatedUS", Value = node.PoolAllocatedUS.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "PoolRemainingUSD", Value = node.PoolRemainingUSD.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "EligibleEmployee", Value = node.EligibleEmployee.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "PlanedEmployee", Value = node.PlanedEmployee.ToString(), Mode = ParameterMode.Value });
    treeNode.CustomAttributes.Add(newConfigItem { Name = "PercentPlaned", Value = node.PercentPlaned.ToString() + "%", Mode = ParameterMode.Value });
     
     
    return treeNode;
     
     
    }
    privatevoid BuildNodes(List<Summary> nodes, Ext.Net.TreeNode parent)
    {
    // Stopped here I want to add children to tree
    int parentId = Convert.ToInt32(parent.NodeID);
    List<Summary> Children = nodes.Where(x => x.ManagerID == parentId).ToList();
    foreach (Summary node in Children)
    {
    Ext.Net.TreeNode ChildNode = AddOneNode(node);
    parent.Nodes.Add(ChildNode);
    if (node.NumberOFChildren > 1)
    {
    BuildNodes(nodes, ChildNode);
    }
    }
    }
    Last edited by Daniil; Nov 16, 2010 at 7:46 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    You have to use loaders to refresh the nodes and call 'reload' method for the root node (root node must be AsyncTreeNode)
    https://examples1.ext.net/#/TreePane...ageTreeLoader/
    https://examples1.ext.net/#/TreePane...h_Static_Tree/

Similar Threads

  1. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 5:03 AM
  2. [CLOSED] Event handler before direct event handlers
    By matejgolob in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 08, 2012, 2:31 PM
  3. Direct method and direct event over SSL?
    By dimitar in forum 1.x Help
    Replies: 0
    Last Post: Oct 08, 2011, 8:09 PM
  4. Replies: 5
    Last Post: Oct 26, 2010, 2:20 PM
  5. Replies: 3
    Last Post: Apr 20, 2010, 12:21 PM

Posting Permissions