[CLOSED] Problem with Grouped Header

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Problem with Grouped Header

    Last edited by Daniil; Apr 23, 2013 at 3:53 AM. Reason: [CLOSED]
  2. #2
    Hi Ermanni,

    After editing a grouped column an error is generated in the browser: Uncaught TypeError: Can not read property 'persist' of undefined.
    I can't reproduce the error. What are exact steps?

    The grouped columns do not display the information of the datasource
    I don't quite understand you. Please clarify.

    I'm using AutoSync in GridPanel.
    An edited cell resets because of the fact that you don't handling synchronization. An example is here.
    https://examples2.ext.net/#/GridPanel/Update/AutoSave/
  3. #3
    Hi Daniil!

    Unfortunately I can not reproduce the problem with a simpler example, as requested by you for analysis. I made the following created a screencast demonstrating the problem and am attaching the output of Firefox (Ctrl + U) to page.

    http://www.screencast.com/t/21A68F5H

    Note that in the first tab (Geral) data is being displayed correctly. The information on the "Geral" and "Sorologia" have the same origin. It turns out that the values ​​generated automatically in the grid "Sorologia" are not listed for the grouped columns.

    When I perform maintenance on these columns the value disappears. Just edit the column that is not grouped (eg "Contra-Prova?") For recorded information being displayed in the grid.

    Thanks!

    Ermanni
    Attached Files
  4. #4
    Thank you for the screencast. It helps understand the problem, but, unfortunately, I am not sure what you should do to remedy the problems.

    Also thank you for the page sources. Though, unfortunately, it is too big for investigating. Passing it via jsbeautifier gives 4051 code lines.

    So, does your initial sample not reproduce any of those problems?
  5. #5
    No. In the sample code the problem does not occur. I just did the test by removing the columns of the grouping columns and everything returned to normal operation. How do I accomplish creating grouped columns through code. The sample code I posted is correct? There are more recommendations for this practice?

    See the excerpt from my class where I create the columns with grouping:

            private ColumnBase CreateStringColumn(GridColumn column)
            {
                var col = column.SummaryType != GridColumnSummary.None ? new SummaryColumn() : new Column();
                col.Text = column.Caption;
    
                if (column.Columns.Any())
                {
                    foreach (var gridColumn in column.Columns)
                    {
                        col.Columns.Add(CreateColumnProxy(gridColumn));
                    }
                }
                else
                {
                    col.ID = column.UniqueName + Id;
                    col.Align = ConvertAlignment(column.HorizontalAlign);
                    col.DataIndex = column.DataField;
                    col.Visible = column.Visible;
                    col.Flex = (column.Width == 0) ? 1 : 0;
                    col.Wrap = true;
                    if (column.Width > 0)
                        col.Width = Unit.Pixel(column.Width);
                    if (!column.ReadOnly)
                    {
                        var textField = new TextField { AllowBlank = !column.IsRequired, IsRemoteValidation = false };
                        if (!column.FormatString.IsNullOrEmpty())
                            textField.Plugins.Add(new InputMask { Mask = column.FormatString });
                        if (!column.ChangeEvent.IsNullOrEmpty())
                        {
                            textField.IsRemoteValidation = true;
                            textField.RemoteValidation.DirectFn = column.ChangeEvent;
                        }
                        if (column.IsValidation)
                        {
                            textField.IsRemoteValidation = true;
                            textField.RemoteValidation.Validation += column.OnValidation;
                        }
                        col.Editor.Add(textField);
                    }
                    if (HeaderEditable)
                        col.HeaderItems.Add(new TextField { ID = "h" + column.DataField + Id, Disabled = column.ReadOnly });
                    if (!string.IsNullOrWhiteSpace(column.ColumnRender))
                        col.Renderer.Handler = column.ColumnRender;
                    if (column.SummaryType != GridColumnSummary.None)
                    {
                        ((SummaryColumn)col).SummaryType = ConvertSummaryType(column.SummaryType);
                        ((SummaryColumn)col).SummaryRenderer.Fn = ConfigureFormat(column);
                    }
                }
    
                return col;
            }
    There's nothing else in creation. Realize the creation of Column and add new columns in the Columns property based on class ColumnBase. I have methods that create columns according to their type (Column, DateColumn, CheckColumn) but these methods always return the type ColumnBase to be compatible with the grouping columns.

    I do not know what to look for. I'm coming to the conclusion not to use this feature.

    Thanks!

    Ermanni.
  6. #6
    Quote Originally Posted by ermanni.info View Post
    How do I accomplish creating grouped columns through code.
    Sorry, I don't quite understand the requirement. Please elaborate. First of all, please clarify what exactly do you mean under "grouped columns"?

    Do you mean this?
    https://examples2.ext.net/#/GridPane...mnHeaderGroup/

    Or the Grouping feature?
    https://examples2.ext.net/#/GridPane...eous/Grouping/
  7. #7
    I'm referring to the resource group headers ....

    https://examples2.ext.net/#/GridPane...mnHeaderGroup/
  8. #8
    Hello!

    I couldn't reproduce your problem too. Can you try to repeat your in ASPX markup and compare result JS code what you get from CodeBehind and from ASPX. However, the best solution to create simplified example which will give us opportunity reproduce and solve your problem or can help you find problem.
  9. #9
    Hi!

    The problem is that with the simplified example the error does not occur. In my application I use to create the grid through code and not by markup. The sample code is at the beginning of this thread and another example of how I create the columns above.

    I ask again: what is the best way to create columns and headers grouped GridPanel?

    Thanks!

    Ermanni
  10. #10
    Quote Originally Posted by ermanni.info View Post
    I ask again: what is the best way to create columns and headers grouped GridPanel?
    Generally, it is the same as it is in the markup. You should populate a Column's Columns collection to get a grouped column with inner columns.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[] 
                { 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" }
                };
                this.Store1.DataBind();
            }
        }
    
        protected void RenderGridPanel(object sender, DirectEventArgs e)
        {
            GridPanel grid = new GridPanel();
    
            Column groupedColumn = new Column()
            {
                Text = "Some group",
                Columns = 
                {
                    new Column()
                    {
                        DataIndex = "test1",
                        Text = "Test1"
                    },
                    new Column()
                    {
                        DataIndex = "test2",
                        Text = "Test2"
                    }
                }
            };
    
            Column simpleColumn = new Column()
            {
                DataIndex = "test3",
                Text = "Test3"
            };
    
            grid.ColumnModel.Columns.Add(groupedColumn);
            grid.ColumnModel.Columns.Add(simpleColumn);
            
            grid.StoreID = "Store1";
    
            this.Form.Controls.Add(grid);
            grid.Render();
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Store ID="Store1" runat="server">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="test1" />
                            <ext:ModelField Name="test2" />
                            <ext:ModelField Name="test3" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            <ext:Button runat="server" Text="Render a GridPanel" OnDirectClick="RenderGridPanel" />
        </form>
    </body>
    </html>
Page 1 of 2 12 LastLast

Similar Threads

  1. Grouped Header
    By idelacruz in forum 2.x Help
    Replies: 0
    Last Post: Mar 05, 2013, 2:28 PM
  2. [CLOSED] Problem when inserting items in grouped grid
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 24, 2012, 3:46 PM
  3. [CLOSED] Grid View Header Row Problem
    By mohan.bizbites in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 19, 2011, 7:17 AM
  4. group header text multiline problem
    By wp_joju in forum 1.x Help
    Replies: 0
    Last Post: Dec 21, 2010, 10:54 AM
  5. Replies: 3
    Last Post: Sep 23, 2010, 2:45 PM

Tags for this Thread

Posting Permissions