Jun 18, 2012, 6:34 PM
[CLOSED] Sort by date in GridPanel
Hi,
I'm trying to sort the GridPanel Store datasource on the server by a data field in descending order. Somehow, it doesn't work for me: the sorting doesn't take effect and the column sorting indicator icon doesn't show up after the page is rendered. What am I missing here?
Thanks,
Vadym
I'm trying to sort the GridPanel Store datasource on the server by a data field in descending order. Somehow, it doesn't work for me: the sorting doesn't take effect and the column sorting indicator icon doesn't show up after the page is rendered. What am I missing here?
Thanks,
Vadym
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store ID="Store1" runat="server" WarningOnDirty="false">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="MyString" />
<ext:RecordField Name="MyDate" Type="Date" SortType="AsDate" SortDir="DESC" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column ColumnID="MyString" Header="My String" DataIndex="MyString" />
<ext:DateColumn ColumnID="MyDate" Format="MMM dd, yyyy" Header="My Date" DataIndex="MyDate" />
</Columns>
</ColumnModel>
</ext:GridPanel>
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DataTable dt = GetDataTable();
this.Store1.DataSource = dt;
this.Store1.DataBind();
this.Store1.Sort("MyDate", Ext.Net.SortDirection.DESC);
}
}
Last edited by Daniil; Jun 19, 2012 at 8:39 PM.
Reason: [CLOSED]