Oct 26, 2010, 8:37 PM
GridPanel export to excel/csv - missing date column formatting
Hi All
I have a GridPanel that databinds to a store as below
grdChartReport.getRowsValues(false,false,false);
And in the codebehind use a XSL to export to XLS
Is there a way to retain the formatting of the row values from the gridpanel while being exported?
Would appreciate any help on this.Thanks
I have a GridPanel that databinds to a store as below
<ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData" >
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="report_week" Type="Date"/>
<ext:RecordField Name="count_report_week" Type="Int" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="grdChartReport" runat="server" Title="Work Completed By week" StoreID="Store1" Frame="true" AnimCollapse="true"
StripeRows="true" Border="true" TrackMouseOver="true" Height="800" Width="740" AutoExpandColumn="report_week" >
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="report_week" Sortable="true" Header="Week Beginning" Width="120">
<Renderer Fn="Ext.util.Format.dateRenderer('m/d/Y')" />
</ext:Column>
<ext:Column DataIndex="count_report_week" Sortable="true" Header="Activity Count">
</ext:Column>
</Columns>
</ColumnModel>
....
</ext:GridPanel>
When I export to Excel, I use the function getRowsValues to get the gridpanel values asgrdChartReport.getRowsValues(false,false,false);
And in the codebehind use a XSL to export to XLS
string json = GridData.Value.ToString();
StoreSubmitDataEventArgs eSubmit = new StoreSubmitDataEventArgs(json, null);
XmlNode xml = eSubmit.Xml;
But getRowsValues() fails to retain the dateformat as mm/dd/YYY and outputs as mm/dd/YYYT00:00:00.000. Is there a way to retain the formatting of the row values from the gridpanel while being exported?
Would appreciate any help on this.Thanks
Last edited by geoffrey.mcgill; May 21, 2011 at 6:03 PM.