Problem with dynamic column header grouping

Page 2 of 3 FirstFirst 123 LastLast
  1. #11
    Quote Originally Posted by Daniil View Post
    It looks upgrading is the only option. Please clarify is that a problem for you?
    Yes, it's more problematic. Last time we upgraded (from Coolite 0.9.x) it was a major headache as there were a lot of breaking changes. The application is really huge: we don't want to have to do a complete thorough test and take high risks with our client.

    So, can you confirm this is an issue with version 1.0? Or can this header grouping be achieved in any other way?

    If upgrading is really the only option, should we go for 1.2 instead of 1.5 or 1.7 in order to have the least impact possible? From reading the changelog, it seems there are only two breaking changes, which are related to the NumberField and done in version 1.3.0.

    Thanks and regards,

    Andrew
  2. #12
    Ok, I see why you don't want to upgrade. Though, upgrading of minor version should be much easier then upgrading of major version. Though, it is always possible that something breaks. Never mind for now.

    It looks I cannot reproduce the problem with v1.0. What is the version of your Ext.Net.dll?
  3. #13
    Ext.Net.dll: 1.0.0.34580
    Ext.Net.Utilities.dll: 1.0.0.34577
    Newtonsoft.Json.dll: 3.5.0.0

    Is the version you used higher than this one?

    Thank you!
  4. #14
    I test with v1.0.0.0.

    I think your one might not the final v1.0 release. It might RC or beta. Do you remember?
  5. #15
    Quote Originally Posted by Daniil View Post
    I think your one might not the final v1.0 release. It might RC or beta. Do you remember?
    I will get back to you on that, but I don't think it's either RC or beta. Meanwhile, is it possible for you to try with that version or confirm if it's not final?
    If you can't get it, in case you are allowed to, I uploaded these 3 dlls here for you to download:
    https://dl.dropboxusercontent.com/u/336163/Ext.Net.rar

    Thanks, once again.
  6. #16
    I've reproduced the problem with your dlls. I don't know the version of that.

    I can suggest the following workaround.
    PrepareGrid(myGrid2);
    myGrid2.Controls.RemoveAt(0); // remove an XTemplate control
    myGrid2.Render();
  7. #17
    The good news: it worked in this example!! Great, thanks!! :)

    The bad news: it's not working in our application.

    I created a new page with the grid and the actual data and it worked, but it's not working in our current grid. It may be related to the fact that the site structure is quite complex. It as as follows, in case you are interested:

    The site basically consists of page links on the left and the pages' content on the right. The main page's masterpage has form -> ext:Viewport -> ext:BorderLayout (West: page links, Center: content) -> ext:Panel -> asp:ContentPlaceHolder. Then the main page has an asp:Content -> ext:FitLayout -> ext:TabPanel.
    Then the masterpage of the page loaded in that tab has form -> ext:Viewport -> asp:ContentPlaceHolder. And finally the actual page has a asp:Content -> ext:Viewport -> ext:GridPanel.

    I did a quick test by adding all these (except the ContentPlaceHolders and Contents) in the example page but it worked. If you can quickly see what may be causing the problem, it would be great. Otherwise, I will try to replicate that scenario separately in order to find exactly when this grouping stops workings... Wish me luck.

    Thanks and regards,

    Andrew
    Last edited by ALobpreis; May 06, 2014 at 7:51 PM.
  8. #18
    This line:
    myGrid2.Controls.RemoveAt(0); // remove an XTemplate control
    Please check there is actually an XTemplate control at 0 index. If no, you should find an XTemplate control and remove that.
  9. #19
    Yes, that XTemplate control is always in the first position.

    I have done lots of tests and finally found out the cause why this fails in our site. It's when the grid is inside a Viewport with Layout="border". It does not occur when Layout is "accordion" or default, for example.

    In this case, when I click the button and Render() is called, the grid just disappears. If I'm debugging it, I see there is an "undefined" exception inside a WebResource.axd in a setLeftTop function.

    After further testing, I discovered that placing the GridPanel inside a Panel does an interesting change: the group headers are finally rendered, but the grid moves to the north region of the Viewport!!! If I'm debugging it, I see that the problem is again in a WebResource.axd, this time in function renderHeaders, where this.cm.rows is undefined.

    Here is the complete code for you to reproduce (the PrepareGrid function is the same as before):

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        [DirectMethod]
        public void OnClick(object sender, DirectEventArgs e)
        {
            PrepareGrid(myGrid2);
            myGrid2.Controls.RemoveAt(0);
            myGrid2.Render();
            btnPrepare.Disabled = true;
        }
    
        private void PrepareGrid(GridPanel grid)
        {
            grid.Reconfigure();
    
            var columns = new string[] { "Text 1", "Number 1", "Text 2", "Number 2", "End Column" };
    
            foreach (string col in columns)
            {
                Column newCol = new Column { Header = col };
                grid.ColumnModel.Columns.Add(newCol);
            }
    
            var headerGroupRow = new HeaderGroupRow();
            var headerGroups = new[] { new { Header = "Date", Span = 2 }, new { Header = "Group 1", Span = 2 },
                new { Header = "Group 2", Span = 2}, new { Header = "", Span = 1}};
    
            foreach (var header in headerGroups)
            {
                headerGroupRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = header.Header,
                    Align = Alignment.Center,
                    ColSpan = header.Span
                });
            }
    
            grid.View.View.HeaderGroupRows.Add(headerGroupRow);
        }
    
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Dynamic Grid Column Header Grouping Problem</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>Dynamic Grid Column Header Grouping Problem</h1>
    
        <ext:Store ID="strEmpty" runat="server" />
    
        <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>
    
                <ext:Panel runat="server" Region="North" Height="200">
                    <Content>
                        <ext:Label runat="server" Text="North Panel" />
                    </Content>
                </ext:Panel>
    
                <ext:Panel runat="server" Region="West" Width="80">
                    <Content>
                        <ext:Button runat="server" ID="btnPrepare" Text="Prepare Grid">
                            <DirectEvents>
                                <Click OnEvent="OnClick" />
                            </DirectEvents>
                        </ext:Button>
                    </Content>
                </ext:Panel>
    
                <ext:Panel runat="server" Region="Center">
                    <Content>
                        <ext:GridPanel ID="myGrid2" runat="server" StoreID="strEmpty">
                            <ColumnModel ID="ColumnModel1" runat="server">
                                <Columns>
                                    <ext:Column Header="Day" />
                                    <ext:Column Header="Time" />
                                </Columns>
                            </ColumnModel>
                            <View>
                                <ext:GroupingView>
                                    <HeaderGroupRows>
                                    </HeaderGroupRows>
                                </ext:GroupingView>
                            </View>
                        </ext:GridPanel>
                    </Content>
                </ext:Panel>
    
            </Items>
        </ext:Viewport>
    
    </body>
    </html>
    I also tried this small demo with versions 1.2 and 1.7 (after removing the .RemoveAt(0) line) and the behavior is the same.

    After checking the DOM of the "scambled" page with the Developer Toolbar, I see that inside the Center panel there is a div with id="myGrid2_Container" which only contains an input (previously had the whole grid, of course), and directly below the body tag there is an empty div with the same id="myGrid2_Container" followed by the actual grid div (id="myGrid2"). I don't know if this may help, but these are my 2 cents.

    Any ideas?
    Thanks a lot and best regards,

    Andrew
    Last edited by ALobpreis; May 07, 2014 at 8:01 PM.
  10. #20
    Yes, a BorderLayout's region cannot be re-rendered directly. You are right that you wrapped it in a Panel.

    To get it working, please replace <Content> with <Items> in that Panel.

    Also remove that:
    grid.Reconfigure();
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. [CLOSED] Dynamic header column component direct event Issue
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 21, 2015, 10:56 PM
  2. [CLOSED] Problem with TreeGrid Column Header...
    By RCN in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 12, 2012, 1:22 PM
  3. [CLOSED] Problem Creating Dynamic Header column for filter
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Jun 23, 2011, 6:59 AM
  4. Replies: 0
    Last Post: Jun 21, 2011, 12:18 PM
  5. Replies: 0
    Last Post: Feb 17, 2010, 5:38 AM

Tags for this Thread

Posting Permissions