Apr 04, 2009, 8:09 AM
How to suppress page reload by setting pager PageIndex
I have store and I handle sorting, paging, filtering by myself on server side:
everything works fine but after I call
*(supressing and resuming events not works for example:
*
*
How to prevent event firing after Pager.PageIndex change? Users are often confused when they see 'page 24 of 1' - but twice reaload makes performance of my application worse...
*Mrozik
*
<ext:Store ID="storeTransportOrderList" runat="server" AutoLoad="true" RemoteSort="true"
* OnRefreshData="StoreTransportOrder_Refresh">
* <Reader>
* <ext:JsonReader ReaderID="Id">
* <Fields>
* <ext:RecordField Name="Checked" />
* <ext:RecordField Name="Id" />
* <ext:RecordField Name="StartDate" Type="Date" />
* <ext:RecordField Name="EndDate" Type="Date" />
* <ext:RecordField Name="TransportRouteCount" Type="Int" />
* <ext:RecordField Name="Route" />
* <ext:RecordField Name="Cost" Type="Float" />
* <ext:RecordField Name="RouteDescription" />
* <ext:RecordField Name="TransportCompanyName" />
* <ext:RecordField Name="StateName" />
* <ext:RecordField Name="ModifiedUserName" />
* <ext:RecordField Name="ModificationDate" Type="Date" />
* <ext:RecordField Name="StatusIndicator" />
* </Fields>
* </ext:JsonReader>
* </Reader>
* <Proxy>
* <ext:DataSourceProxy />
* </Proxy>
* <AutoLoadParams>
* <ext:Parameter Name="start" Value="={0}" />
* <ext:Parameter Name="limit" Value="={20}" />
* </AutoLoadParams>
* <SortInfo Direction="DESC" Field="Id" />
* *
* </ext:Store>
In OnRefreshData handler I check or total count of reded data is lower than current (page * page size) and I want to set my page to 1:* MyQuery query = new MyQuery();
* query.Start = e.Start;
* query.Limit = e.Limit;
*
* this.storeTransportOrderList.DataSource = MyDatabaseServiceClass.VTransportOrderFindAll(query);
*e.TotalCount = query.Count;
* if (query.Count < e.Start) //filtering causes there is no data on this page - jump to 1 page
* PagingToolbarTransportOrder.SetPageIndex(0);
* *
* this.storeTransportOrderList.DataBind();
*
everything works fine but after I call
PagingToolbarTransportOrder.SetPageIndex(0);
*OnRefreshData handler fires once again ....*(supressing and resuming events not works for example:
*
*PagingToolbarTransportOrder.SuspendEvents();
*PagingToolbarTransportOrder.SetPageIndex(0);
*PagingToolbarTransportOrder.ResumeEvents();
*
*- I tried it on pager, store, gridPanel...)*
How to prevent event firing after Pager.PageIndex change? Users are often confused when they see 'page 24 of 1' - but twice reaload makes performance of my application worse...
*Mrozik
*