e.Sort is empty after paging

  1. #1

    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.

    <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
  2. #2
    Hi,

    Please set SortInfo for the Store
  3. #3
    Quote Originally Posted by Vladimir View Post
    Hi,

    Please set SortInfo for the Store
    Ok so in my case the value would be SortInfo="ProductId" ?

Similar Threads

  1. Replies: 4
    Last Post: Jul 25, 2011, 4:57 PM
  2. Sort and Paging in MVC
    By Dominik in forum 1.x Help
    Replies: 0
    Last Post: Jun 30, 2010, 9:44 AM
  3. [CLOSED] Paging is empty after addRecord to the store
    By tms in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 25, 2010, 11:53 AM
  4. Replies: 0
    Last Post: Jun 26, 2009, 11:32 AM
  5. Sort with Conditional sort direction in JS- help!
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: May 05, 2009, 12:11 PM

Tags for this Thread

Posting Permissions