Group By a Date Type Makes Row Selection impossible

  1. #1

    Group By a Date Type Makes Row Selection impossible

    I have found that grouping a gridpanel by strings and integers works perfectly and exactly as desired in the examples. However, if the groupfield tag is set to a model property that is a defined Type="Date" it renders the RowSelection inactive except on the first row of data in each group.

                 <Store>
                    <ext:Store ID="Store2" runat="server" DataSourceID="linqsource1" GroupField="shipdate">
                        <Model>
                            <ext:Model ID="Model2" runat="server" >
                                <Fields>
                                    <ext:ModelField Name="mrcID"  Type="String"/>  
                                    <ext:ModelField Name="itemID" Type="String"/>
                                    <ext:ModelField Name="shipto" Type="String"/>
                                    <ext:ModelField Name="shipdate" Type="Date"/>
                                    <ext:ModelField Name="bpolineID" Type="String"/>
                                    <ext:ModelField Name="orderqty" Type="Int"/>
                                    <ext:ModelField Name="shipped" Type="Int"/>
                                    <ext:ModelField Name="received" Type="Int"/>
                                    <ext:ModelField Name="itemdesc" Type="String"/>                                               
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
    It is easily worked around though. I was able to group by date by defining it a String in the Model, then customize it's appearance in the header by referencing the data in the template of my GroupingSummary.

                <Store>
                    <ext:Store ID="Store2" runat="server" DataSourceID="linqsource1" GroupField="shipdate">
                        <Model>
                            <ext:Model ID="Model2" runat="server" >
                                <Fields>
                                    <ext:ModelField Name="mrcID"  Type="String"/>  
                                    <ext:ModelField Name="itemID" Type="String"/>
                                    <ext:ModelField Name="shipto" Type="String"/>
                                    <ext:ModelField Name="shipdate" Type="String"/>
                                    <ext:ModelField Name="bpolineID" Type="String"/>
                                    <ext:ModelField Name="orderqty" Type="Int"/>
                                    <ext:ModelField Name="shipped" Type="Int"/>
                                    <ext:ModelField Name="received" Type="Int"/>
                                    <ext:ModelField Name="itemdesc" Type="String"/>                                               
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
    <ext:GroupingSummary ID="GroupingSummary1" 
         runat="server" HideGroupedHeader="false" StartCollapsed="false" 
         GroupHeaderTplString="{[Ext.util.Format.date([values.rows[0].data.shipdate],'Y/m/d')]}">                      
     </ext:GroupingSummary>
  2. #2
    Hi @Exponentious,

    It appears to be working in this example.

    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)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { DateTime.Today, "1", "1" },
                    new object[] { DateTime.Today, "11", "11" },
                    new object[] { DateTime.Today, "111", "111" },
                    new object[] { DateTime.Today.AddDays(1), "2", "2" },
                    new object[] { DateTime.Today.AddDays(1), "22", "22" },
                    new object[] { DateTime.Today.AddDays(1), "222", "222" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server" GroupField="date">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="date" Type="Date" />
                                    <ext:ModelField Name="test1" />
                                    <ext:ModelField Name="test2" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Date" DataIndex="date" />
                        <ext:Column runat="server" Text="Test1" DataIndex="test1" />
                        <ext:Column runat="server" Text="Test2" DataIndex="test2" />
                    </Columns>
                </ColumnModel>
                <Features>
                    <ext:Grouping runat="server" />
                </Features>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3

    Can't recreate

    Hmm not able to recreate the issue in the test page. I tried using the LinqDataSource that i was using at the time, thinking it may have been a type mismatch from the server of some translation there. To no avail.

    Then i thought I might try to recreate the entire page I had found the issue with on a fresh project. The error does not reappear, perhaps its an error in the larger project. Suppose this one can be closed then...thanks for taking a look.
  4. #4
    Ok, if you can provide a test case ever, please feel free to post.

Similar Threads

  1. [CLOSED] Default date format for Type="Date" RecordField
    By r_honey in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: May 29, 2012, 3:16 PM
  2. Default value for date type variable
    By emon in forum 1.x Help
    Replies: 10
    Last Post: Mar 10, 2011, 9:35 AM
  3. Replies: 1
    Last Post: Feb 15, 2011, 5:45 PM
  4. With regard to the date of the type stroe
    By guoweidong in forum 1.x Help
    Replies: 2
    Last Post: Mar 10, 2010, 12:05 AM
  5. RecordField type="date" in coolite 0.8
    By dperera in forum 1.x Help
    Replies: 8
    Last Post: Sep 01, 2009, 5:49 PM

Posting Permissions