Sep 15, 2010, 3:47 PM
Custom paging in grid has issues
In the Paging Toolbar of a GridPanel, I have a ComboBox set up to display four items:
25
50
100
ALL
The idea is to allow Users to select the number of rows they would like to see per page. The default number of rows or PageSize is 50.
Issue 1: The moment I touch paging related code during runtime, the browser (FireFox and IE) starts to hang and then run slowly.
Issue 2: Also the paging display "Page X of Y" becomes incorrect:
Here is the function that I call to update paging when the User selects a value from the ComboBox (called ddnRowsPerPage):
25
50
100
ALL
The idea is to allow Users to select the number of rows they would like to see per page. The default number of rows or PageSize is 50.
Issue 1: The moment I touch paging related code during runtime, the browser (FireFox and IE) starts to hang and then run slowly.
Issue 2: Also the paging display "Page X of Y" becomes incorrect:
Here is the function that I call to update paging when the User selects a value from the ComboBox (called ddnRowsPerPage):
function fnRedoPaging() {
rowsPerPage = ddnRowsPerPage.getValue();
if (rowsPerPage == "ALL") {
rowsPerPage = strResults.totalLength;
}
//debugger;
strResults.start = 0;
strResults.limit = rowsPerPage;
strResults.applyPaging();
pgTbr.pageSize = rowsPerPage;
pgTbr.doLoad(pgTbr.cursor);
};
And here is the GridPanel and Store rendering code: <ext:Store ID="strResults" IDMode="Static" runat="server" OnSubmitData="strResults_Submit">
<Reader>
<ext:ArrayReader>
<Fields>
</Fields>
</ext:ArrayReader>
</Reader>
<AutoLoadParams>
<ext:Parameter Name="start" Value="0" Mode="Raw"/>
<ext:Parameter Name="limit" Value="50" Mode="Raw"/>
</AutoLoadParams>
<DirectEventConfig IsUpload="true"></DirectEventConfig>
</ext:Store>
<ext:GridPanel ID="grdResults" runat="server" StoreID="strResults" Header="false" MonitorResize="true">
<TopBar>
<ext:PagingToolbar ID="pgTbr" runat="server" PageSize="50">
<Items>
<ext:ToolbarSeparator ID="sr" runat="server"></ext:ToolbarSeparator>
<ext:ComboBox ID="ddnRowsPerPage" runat="server" Editable="false" FieldLabel="Rows Per Page"
Width="175" ForceSelection="true" SelectedIndex="1" TriggerAction="All"
FireSelectOnLoad="True" SelectOnFocus="true">
<Listeners>
<Select Handler="fnRedoPaging()" />
</Listeners>
<Items>
<ext:ListItem Text="25" Value="25" />
<ext:ListItem Text="50" Value="50" />
<ext:ListItem Text="100" Value="100" />
<ext:ListItem Text="ALL" Value="ALL" />
</Items>
</ext:ComboBox>
<ext:ToolbarSeparator ID="tbrSep" runat="server"></ext:ToolbarSeparator>
<ext:Button ID="btnExcel" runat="server" Text="To Excel" Icon="PageExcel">
<Listeners>
<Click Handler="exportData('xls');" />
</Listeners>
</ext:Button>
</Items>
</ext:PagingToolbar>
</TopBar>
<BottomBar>
</BottomBar>
<LoadMask ShowMask="true" Msg="Loading Results..." />
</ext:GridPanel>