TreePanel Add new nodes direct method

  1. #1

    TreePanel Add new nodes direct method

    i have a tree panel which does not include a root\ children in the markup.
    <ext:TreePanel
    ID="TreePanel1"
    runat="server"
    Height="400"
    Width="200"
    UseArrows="true"
    AutoScroll="true"
    Animate="true"
    HideHeaders="true">
    <Fields>
    <ext:ModelField Name="guid" />
    </Fields>
    <TopBar>
    <ext:Toolbar ID="Toolbar1" runat="server">
    <Items>

    <ext:Button ID="btnNewt" runat="server" Text="New" StandOut="true" Icon="Add">
    <DirectEvents>
    <Click OnEvent="btnNew_click" Timeout="100000"></Click>
    </DirectEvents>
    </ext:Button>
    </Items>
    </ext:Toolbar>
    </TopBar>


    <ColumnModel>
    <Columns>
    <ext:TreeColumn ID="TreeColumn1" runat="server" Flex="1" DataIndex="text" />

    <ext:CommandColumn ID="CommandColumn2" runat="server" Width="40">
    <Commands>
    <ext:GridCommand CommandName="Select" Icon="Accept" ToolTip-Text="Select Project" />
    </Commands>
    <PrepareToolbar Handler="return record.data.leaf;" />

    <DirectEvents>
    <Command OnEvent="Project_TreeSelect" Timeout="100000">
    <EventMask ShowMask="true"></EventMask>
    <ExtraParams>
    <ext:Parameter
    Name="Values" Value="#{TreePanel1};">
    </ext:Parameter>
    <ext:Parameter Name="Valu" Value="node" />
    </ExtraParams>
    </Command>
    </DirectEvents>
    </ext:CommandColumn>
    </Columns>
    </ColumnModel>

    </ext:TreePanel>

    on page load i am doing this


    Node root = new Node();
    root.NodeID = "Projects";
    root.Leaf = false;
    root.Expanded = true;
    root.Icon = Icon.ChartOrganisation;


    foreach (var a in Projects)
    {
    Node n = new Node();
    n.Text = a.ProjectName;
    n.CustomAttributes.Add(new ConfigItem { Name = "guid", Value = a.ProjectId.ToString() });
    n.Leaf = true;
    n.Icon = Icon.Package;

    root.Children.Add(n);
    }
    TreePanel1.Root.Add(root);

    this works on page load , but if i call the same method again ( after some addition \ removal from the tree nodes ) the refresh does not happen . what am i doing wrong here ?


    help is appreciated

    Thanks
    Rajat
  2. #2
    Hello!

    Please, don't forget to wrap your code in CODE tag. Read paragraph 3 here: http://forums.ext.net/showthread.php?10205

    About your problem, I guess this example can be helpful: https://examples2.ext.net/#/TreePane...Direct_Method/
  3. #3
    Hi Baidaly,

    Thanks for the reply .
    "Please, don't forget to wrap your code in CODE tag" :not sure why would you want me to wrap my code inside 'CODE' i was writing everything server side...well atleast till now .

    but yes ,the example helps.
    Thanks .Kindly close the Thread

Similar Threads

  1. Replies: 2
    Last Post: Jul 15, 2013, 4:06 AM
  2. [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
  3. Replies: 18
    Last Post: Jan 23, 2013, 3:20 PM
  4. Direct method and direct event over SSL?
    By dimitar in forum 1.x Help
    Replies: 0
    Last Post: Oct 08, 2011, 8:09 PM
  5. [CLOSED] Update a nodes iconcls and cls properties in direct method.
    By Labyrinth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 02, 2010, 1:29 PM

Tags for this Thread

Posting Permissions