[CLOSED] TreeGrid Root Node is Nothing

  1. #1

    [CLOSED] TreeGrid Root Node is Nothing

    I'm tring to loop through all the nodes on a directevent to find a specific node. Then change the CustomAttributes. The root node comes up as null

    <ext:TreeGrid ID="tpPrivate" runat="server" ViewStateMode="Enabled">
    <Columns>
           <ext:TreeGridColumn Header="Menu" Width="230" DataIndex="Menu" />
           <ext:TreeGridColumn Header="View" Width="80" DataIndex="View" Align="Center" />
            <ext:TreeGridColumn Header="Permissions" Width="150" DataIndex="Permissions" Align="Center" />
    </Columns>
    <DirectEvents>
        <Click OnEvent="tpPrivate_Click" ViewStateMode="Enabled">
                <ExtraParams>
                        <ext:Parameter Name="NodeId" Value="node.id" Mode="Raw" >
                         </ext:Parameter>
                 </ExtraParams>
        </Click>
    </DirectEvents>
    </ext:TreeGrid>
    Here is the code behind:
    Public Sub tpPrivate_Click(ByVal sender As Object, ByVal e As DirectEventArgs)
            Dim t As String = e.ExtraParams("NodeId")
            Dim p As TreeNode = tpPrivate.Root.Primary
            
            p.CustomAttributes.Add(New Ext.Net.ConfigItem("Menu", p.Text, Ext.Net.ParameterMode.Value))
            p.CustomAttributes.Add(New Ext.Net.ConfigItem("View", "Yes", Ext.Net.ParameterMode.Value))
            p.CustomAttributes.Add(New Ext.Net.ConfigItem("Permissions", "Add", Ext.Net.ParameterMode.Value))
        End Sub
    Last edited by Baidaly; Feb 06, 2013 at 11:30 PM. Reason: [CLOSED]
  2. #2
    Hi @HOWARDJ,

    I can't see where you set up a Root before reading. I think it is required.

    Also changing CustomAttrbibutes when a node is already rendered doesn't affect on client.

    You could try to re-render the TreeGrid.

    Also you might be interested to look at this thread.
    http://forums.ext.net/showthread.php?10965
  3. #3

    TreeGrid Root Node is Nothing

    Hi Daniil
    That previous post was very helpful. If I make changes to the columns on the client side, can I submit ALL Nodes to the server side so I can loop through and write them to a database?

    Howard
  4. #4
    Yes, I think the submitNodes method should work for a TreeGrid and updated nodes.
    https://examples1.ext.net/#/TreePanel/Basic/Submit/
  5. #5

    TreeGrid Root Node is Nothing

    Yes, I've tried this example and it only comes back with 1 node. I have 5 nodes loaded. Although I did not show the code above, I dynamically added 5 nodes which works just fine. I need to make changes to the columns on the client side which works fine now. The last step for me would be to submit all the nodes and loop through them from the root and insert them into a database.
  6. #6
    Do you see the nodes in parameters of a submit request?

    Yes, I've tried this example and it only comes back with 1 node.
    Not sure that I understand it correctly. Where do you see 1 node?
  7. #7

    TreeGrid Root Node is Nothing

    My mistake... the example only returns the count for the number of children for that parent, so thats why I received a count of 1. This seems to work for all nodes. This thread can be closed.

    Thanks,
    Howard
  8. #8
    Sure, the nodes hierarchy is maintained.

Similar Threads

  1. TreePanel without Root node
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jun 25, 2014, 7:07 PM
  2. Replies: 0
    Last Post: Aug 09, 2012, 8:30 AM
  3. How to get treegrid total node count.
    By bjones in forum 1.x Help
    Replies: 3
    Last Post: Jan 11, 2012, 5:42 PM
  4. TreeGrid - fore color of a node
    By Kedar in forum 1.x Help
    Replies: 1
    Last Post: Jan 11, 2011, 7:45 AM
  5. [CLOSED] Treegrid Node Icon
    By sharif in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 23, 2010, 12:11 PM

Tags for this Thread

Posting Permissions