Grid Paging issue

  1. #1

    Grid Paging issue

    If grid refreshed while having on a last page, the pagination count displayed on right bottom is wrong.
    Please see attached image for reference.
    Attached Thumbnails Click image for larger version. 

Name:	pagination_issue.jpg 
Views:	246 
Size:	80.1 KB 
ID:	3663  
  2. #2
    Hi,

    Please clarify what way is a grid refreshed?

    Could you provide a sample to reproduce?
  3. #3
    Quote Originally Posted by pooja View Post
    If grid refreshed while having on a last page, the pagination count displayed on right bottom is wrong.
    Please see attached image for reference.

    Suppose we have 40 records in a search result and grid page size is 10.

    Following are the steps I followed:

    1. Navigated to 4th (last page) on a grid.
    2. While being on the 4th page, I changed search filters and searched records again.
    3. Total record count was 17.
    4. And grid message shown "11-20 of 17" and current page was page No. 2.
  4. #4
    Confirmed.

    I can suggest the following fix.

    Fix
    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
    <script type="text/javascript">
        Ext.ux.grid.GridFilters.override({
            reload : function () {
                if (this.local) {
                    this.grid.store.clearFilter(true);
                    this.grid.store.filterBy(this.getRecordFilter());
                    var pt = this.grid.getPagingToolbar();
                    if (pt) {
                        pt.changePage(1);
                    }
                } else {
                    var start,
                        store = this.grid.store;
                    this.deferredUpdate.cancel();
                    start = store.paramNames.start;
                    if (store.lastOptions && store.lastOptions.params && store.lastOptions.params[start]) {
                        store.lastOptions.params[start] = 0;
                    }
                    store.reload(undefined, true);
                }
            }
        });
    </script>
    Here is the full example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                object[] data = new object[40];
                for (int i = 0; i < 40; i++)
                {
                    data[i] = new object[] { i };
                }
                store.DataSource = data;
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
        <script type="text/javascript">
            Ext.ux.grid.GridFilters.override({
                reload : function () {
                    if (this.local) {
                        this.grid.store.clearFilter(true);
                        this.grid.store.filterBy(this.getRecordFilter());
                        var pt = this.grid.getPagingToolbar();
                        if (pt) {
                            pt.changePage(1);
                        }
                    } else {
                        var start,
                            store = this.grid.store;
                        this.deferredUpdate.cancel();
                        start = store.paramNames.start;
                        if (store.lastOptions && store.lastOptions.params && store.lastOptions.params[start]) {
                            store.lastOptions.params[start] = 0;
                        }
                        store.reload(undefined, true);
                    }
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel 
                ID="GridPanel1" 
                runat="server" 
                AutoHeight="true">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="test" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column Header="Test" DataIndex="test" />
                    </Columns>
                </ColumnModel>
                <Plugins>
                    <ext:GridFilters runat="server" Local="true">
                        <Filters>
                            <ext:NumericFilter DataIndex="test" />
                        </Filters>
                    </ext:GridFilters>
                </Plugins>
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="10" />
                </BottomBar>
            </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  2. [CLOSED] GridPanel: issue with paging when using DirectMethod
    By Leonid_Veriga in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 16, 2012, 10:04 AM
  3. Paging Issue
    By wdk in forum 1.x Help
    Replies: 2
    Last Post: Mar 25, 2011, 3:46 AM
  4. [CLOSED] [1.0] Issue with paging on grid load.
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 02, 2010, 5:04 PM
  5. Replies: 1
    Last Post: Oct 09, 2009, 3:46 AM

Tags for this Thread

Posting Permissions