Nov 04, 2010, 7:26 AM
e.Sort is empty after paging
Hi,
The e.Sort property in the Refresh event handler comes as empty after paging but it work's on the first load.
Thanks
The e.Sort property in the Refresh event handler comes as empty after paging but it work's on the first load.
<ext:ResourceManager ID="ScriptManager1" runat="server" Theme="Gray">
<Listeners>
<DocumentReady Fn="onDocumentReady(#{GridPanel1})" />
</Listeners>
</ext:ResourceManager>
<ext:Store ID="Store1" runat="server" RemoteSort="true" OnRefreshData="Store1_RefreshData"
EnableViewState="true">
<AutoLoadParams>
<ext:Parameter Name="sort" Value="ProductId" Mode="Value" />
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="10" Mode="Raw" />
</AutoLoadParams>
<Proxy>
<ext:PageProxy />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="ProductId">
<Fields>
<ext:RecordField Name="ProductId" />
<ext:RecordField Name="ProductName" Type="String" />
<ext:RecordField Name="ProductUrl" Type="String" />
<ext:RecordField Name="ProductImageUrl" Type="String" />
<ext:RecordField Name="ProductPrice" ServerMapping="ProductActualPrice" Type="Float" />
<ext:RecordField Name="DisplayOrder" Type="String" />
<ext:RecordField Name="IsActive" Type="Boolean" />
<ext:RecordField Name="CreateDate" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
BindProducts(e.Sort + (e.Dir.ToString() == "Default" ? "" : " " + e.Dir), e.Start, e.Limit);
}
private void BindProducts(string sort, int start, int limit)
{
ReadWriteCustomCollection<Product> data = null;
int totalCount = 0;
if (this._useSearch)
{
string _searchProductName = txtToolbarSearch.Text;
int _parentCategoryId;
Int32.TryParse(ddlToolbarCategories.SelectedItem.Value, out _parentCategoryId);
if (_parentCategoryId == SiteUtility.SuperRootCategoryId)
_parentCategoryId = 0;
data = Product.GetBackEndProductListBySearch(_searchProductName, _parentCategoryId, false, sort, start, limit);
totalCount = Product.GetBackEndProductListBySearchCount(_searchProductName, _parentCategoryId, false);
Session["_useSearch"] = null;
}
else
{
data = Product.GetBackEndProductListBySearch("", 0, false, sort, start, limit);
totalCount = Product.GetBackEndProductListBySearchCount("", 0, false);
}
Store1.DataSource = data;
Store1.DataBind();
(Store1.Proxy[0] as PageProxy).Total = totalCount;
}
Any sort of help would be greatly appreciated.Thanks