PDA

View Full Version : [CLOSED] Problem in Date Format in Summary Column



Tonic
May 15, 2013, 1:03 PM
sir,

i am using Gridpanel whichis using a SQl Query that returns some data with a Date in format (2013-05-13).
now when i am filling the store with the query it is returning Date in Some odd Format Like (01 01 2013T00:00:00)
i change some propety in model and Summary Column it is still not working properly

Design Code is

<ext:GridPanel ID="gpAssgDetails" Title="Assignments" Height="235" Icon="SitemapColor"
runat="server" ColumnLines="false">
<Store>
<ext:Store ID="strEmpAssg" runat="server" GroupField="assg_desc">
<Model>
<ext:Model ID="mdlAssgDetails" runat="server" IDProperty="pk_newEmpMapping">
<Fields>
<ext:ModelField Name="assg_validfrom" Type="Date" DateReadFormat="dd/MM/yyyy" DateWriteFormat="dd/MM/yyyy" >
</ext:ModelField>
<ext:ModelField Name="assg_validto" Type="Date" DateReadFormat="dd/MM/yyyy" DateWriteFormat="dd/MM/yyyy" >
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="cmEmpAssg" runat="server">
<Columns>
<ext:SummaryColumn ID="assg_validfrom" DataIndex="assg_validfrom" SummaryType="None"
runat="server" Sortable="true" Text="Valid From" DateFormat="dd/MM/yyyy" >
</ext:SummaryColumn>
<ext:SummaryColumn ID="assg_validto" DataIndex="assg_validto" SummaryType="None"
runat="server" Sortable="true" Text="Value To" DateFormat="dd/MM/yyyy">

</ext:SummaryColumn>
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="gvAssgView" runat="server" StripeRows="true" MarkDirty="false" />
</View>
<Features>
<ext:GroupingSummary ID="gsAssgDetails" runat="server" GroupHeaderTplString='{columnName}: {name} ({rows.length} Element{[values.rows.length > 1 ? "s" : ""]})'
HideGroupedHeader="true" EnableNoGroups="true" EnableGroupingMenu="true" />
</Features>
</ext:GridPanel>


after this code ..Date Format is "Tue Mar 12 2013 00:00:00 GMT+530(INDIAN STANDARD TIME)"
please Help Me.... I just need 12/12/2013 or12-12-2013...

RCN
May 15, 2013, 2:42 PM
Please set ModelField's Type and DateFormat properties as shown below:



<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="PropertyA" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>


Please take a look on the following example:
http://examples2.ext.net/#/GridPanel/ColumnModel/Ajax_Configuration/

I would also recommend you take a look on the following page:
http://forums.ext.net/showthread.php?21966-Converting-date-format-from-C-to-Ext

Tonic
May 16, 2013, 5:12 AM
i tries DateFormat="M/d hh:mmtt" also , but on using it..my Gridpanel does not show any thing.. it goes blank...!

Daniil
May 16, 2013, 5:40 AM
Hi @Tonic,

Please use a SummaryColumn's Renderer instead of its DateFormat. A SummaryColumn doesn't support DateFormat.

Example

<ext:SummaryColumn runat="server">
<Renderer Format="Date" FormatArgs="'d/m/Y'" />
</ext:SummaryColumn>

Tonic
May 16, 2013, 6:37 AM
Sir,
i used


<ext:SummaryColumn ID="classg_validfrom" runat="server" DataIndex="assg_validfrom"
Text="Valid From">
<Renderer Format="Date" FormatArgs="'d/m/Y'" />
</ext:SummaryColumn>
<ext:SummaryColumn ID="classg_validto" runat="server" DataIndex="assg_validto"
Text="Valid Till">
<Renderer Format="Date" FormatArgs="'d/m/Y'" />
</ext:SummaryColumn>




with model field

<ext:ModelField Name="assg_validfrom">
</ext:ModelField>
<ext:ModelField Name="assg_validto" >
</ext:ModelField>

but it is not working..
i have attached a image please look it , u will get some idea...

i need simple format like "mm/dd/yyyy".
please suggest me..

Tonic
May 16, 2013, 7:23 AM
I did in the way you suggested... and it is working..