[CLOSED] [#533] TreeGrid with dynamic nodes, layout problems

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] [#533] TreeGrid with dynamic nodes, layout problems

    There are two display problems here: first, in chrome, the column headers overlap. Second in both IE and Chrome, my icons are not showing up. I saw a similar post with the column overlap problem that was solved by HideMode="Offsets" but that didn't work here. I apologize for the namespace "v1" but our application uses both versions and in order to create an example, the namespace is needed.

    <%@ Page Language="vb" %>
    <%@ Import Namespace="Ext.Net.v1" %>
     <script runat="server">
         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
             Dim root As New Ext.Net.v1.TreeNode("Households")
             root.Expanded = True
             root.Text = "All Households"
             root.Leaf = False
             root.Icon = Icon.Folder
             tgHouseholds.Root.Add(root)
       
             root.Nodes.Add(Me.CreateNodeWithChildren())
             
             fpTrees.DoLayout
          
         End Sub
         Private Function CreateNodeWithChildren() As Ext.Net.v1.TreeNode
             Dim treeNode As Ext.Net.v1.TreeNode
    
             treeNode = New Ext.Net.v1.TreeNode()
             With treeNode
                 .Expanded = True
                 .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "ID", .Value = 12345, .Mode = ParameterMode.Value})
                 .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "DisplayName", .Value = "John Smith", .Mode = ParameterMode.Value})
                 .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "Address", .Value = "4355 Main Street", .Mode = ParameterMode.Value})
                 .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "AccountNumber", .Value = "", .Mode = ParameterMode.Value})
                 .Leaf = False
                 .NodeID = 12345
                 .Text = "John Smith"
                 .AllowDrag = False
                 .Qtip = "3 Accounts"
                 .Icon = Icon.Folder
             End With
    
             treeNode.Nodes.Add(CreateNodeWithOutChildren(1))
             treeNode.Nodes.Add(CreateNodeWithOutChildren(2))
             
             Return treeNode
         End Function
         Private Function CreateNodeWithOutChildren(i As Integer) As Ext.Net.v1.TreeNode
             Dim treeNode As Ext.Net.v1.TreeNode
    
             treeNode = New Ext.Net.v1.TreeNode
             With treeNode
                 .Leaf = True
                 Select Case i
                     Case 1
                         .NodeID = 11
                         .Text = "Mary Smith"
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "ID", .Value = 11, .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "DisplayName", .Value = "Mary Smith", .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "Address", .Value = "", .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "AccountNumber", .Value = "ATX9943", .Mode = ParameterMode.Value})
                         .Icon = Icon.User
                     Case 2
                         .NodeID = 22
                         .Text = "John Smith"
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "ID", .Value = 22, .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "DisplayName", .Value = "John Smith", .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "Address", .Value = "", .Mode = ParameterMode.Value})
                         .CustomAttributes.Add(New Ext.Net.v1.ConfigItem With {.Name = "AccountNumber", .Value = "ATX4933", .Mode = ParameterMode.Value})
                         .Icon = Icon.User
                 End Select
             End With
    
             Return treeNode
         End Function
    
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager" runat="server" />
            <ext:Panel runat="server" Border="false" Layout="FitLayout" Height="500">
            <Items>
                <ext:FormPanel ID="fpTrees" Title="Assign Accounts" runat="server" Layout="HBoxLayout" HideMode="Offsets" Border="false" Padding="20" AutoScroll="true">
                    <Items>
                        <ext:Container runat="server" Flex="1" Margins="0 20 0 0" Layout="FormLayout" HideMode="Offsets" AutoHeight="true" DefaultAnchor="100%">
                            <Items>
                                <ext:TreeGrid id="tgHouseholds"
                                    runat="server"
                                    Title="Household and Accounts"
                                    Width="300"
                                    Height="600"
                                        HideMode="Offsets"
                                    autoscroll="true">
                                    <Columns>
                                        <ext:TreeGridColumn Header="ID" Width="230" Hidden="true" DataIndex="ID" />
                                        <ext:TreeGridColumn Header="HouseholdName" Width="130" DataIndex="DisplayName" />
                                        <ext:TreeGridColumn Header="Address" Width="130" DataIndex="Address" />
                                        <ext:TreeGridColumn Header="AccountNumber" Width="100" DataIndex="AccountNumber">
                                        </ext:TreeGridColumn>
                                    </Columns>
                                </ext:TreeGrid>
                            </Items>
                        </ext:Container>
                    </Items>
                </ext:FormPanel>
            </Items>
            </ext:Panel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Aug 25, 2014 at 11:08 AM. Reason: [CLOSED] [#533]
  2. #2
    Hi @rmelancon,

    It looks that a hidden TreeGridColumn is a root of problems.

    Please try to remove:
    <ext:TreeGridColumn Header="ID" Width="230" Hidden="true" DataIndex="ID" />
  3. #3
    That seems to fix it. Though I need to have that ID available (tied to the row) but not visible. Any ideas for a workaround? Any other property of the row I could use?

    Thanks,
    Robb
  4. #4
    Please demonstrate the code how do you access IDs? Does that code stop working if you remove the hidden TreeGridColumn?
  5. #5
    <edited> I can just set the NodeID to the id and that will solve the immediate problem. However I still have many cases where I will need to hide and show columns based on user preferences. Is there a workaround for being able to hide columns without it causing the overlap problem?

    Thanks,
    Robb
    Last edited by rmelancon; Aug 12, 2014 at 6:43 PM.
  6. #6
    However I still have many cases where I will need to hide and show columns based on user preferences. Is there a workaround for being able to hide columns without it causing the overlap problem?
    Do you need to do that on the fly? If so, I think re-rendering of a TreeGrid is the only solid solution.
  7. #7
    Yes, columns are shown and hidden, then save to a preferences table. So to re-render just call the .Render() method?
  8. #8
    Yes, columns are shown and hidden
    At which moment?

    So to re-render just call the .Render() method?
    Yes, it should be enough.
  9. #9
    Let me modify the example to reflect how the columns are hidden etc.
  10. #10
    I just modified the Page_Load to call render on the treegrid and I get a javascript error: Unexpected token }

         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
             Dim root As New Ext.Net.v1.TreeNode("Households")
             root.Expanded = True
             root.Text = "All Households"
             root.Leaf = False
             root.Icon = Icon.Folder
             tgHouseholds.Root.Add(root)
        
             root.Nodes.Add(Me.CreateNodeWithChildren())
             tgHouseholds.Render()
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Treegrid nodes
    By AlbertoCe in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 26, 2012, 10:05 AM
  2. [CLOSED] TreeGrid doesn't display nodes
    By agonzalez in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 05, 2012, 12:01 PM
  3. Custom TreeGrid nodes ?
    By Mohammad in forum 1.x Help
    Replies: 18
    Last Post: Aug 22, 2012, 9:49 AM
  4. Replies: 7
    Last Post: Oct 06, 2010, 6:44 PM
  5. [CLOSED] TreeGrid example on examples.ext.net does not show any nodes
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 24, 2010, 4:44 PM

Posting Permissions