[CLOSED] PagingToolbar

  1. #1

    [CLOSED] PagingToolbar

    Hello,

    If you demo the example below you will notice a minor bug in the GridPanel and PagingToolbar when the data source changes over an AjaxEvent.

    Example:
    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                Store1.DataSource = new object[] {
                    new object[] { 1, "A" },
                    new object[] { 2, "B" },
                    new object[] { 3, "C" },
                    new object[] { 4, "D" },
                    new object[] { 5, "E" },
                    new object[] { 6, "F" },
                    new object[] { 7, "G" },
                    new object[] { 8, "H" },
                    new object[] { 9, "I" },
                    new object[] { 10, "J" }
                };
                Store1.DataBind();
            }
        }
    
        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            Store1.DataSource = new object[] {
                new object[] { 1, "A" },
                new object[] { 2, "B" }
            };
            Store1.DataBind();
    
        }
        
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:ArrayReader ReaderID="Id">
                        <Fields>
                            <ext:RecordField Name="Id" />
                            <ext:RecordField Name="Name" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>
            </ext:Store>
            <ext:GridPanel ID="GridPanel1" EnableViewState="true" AutoHeight="true" runat="server"
                StoreID="Store1" Title="List" Icon="Application">
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column Header="Id" Sortable="true" DataIndex="Id" />
                        <ext:Column Header="Name" Sortable="true" DataIndex="Name" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="4" />
                </BottomBar>
                <LoadMask Msg="Loading" ShowMask="true" />
            </ext:GridPanel>
            <ext:Button ID="Button1" runat="server" Text="Filter">
                <AjaxEvents>
                    <Click OnEvent="Button1_Click" />
                </AjaxEvents>
            </ext:Button>
        </form>
    </body>
    </html>
    Replication steps:
    1. Load page
    2. Advance to page 3
    3. Click Filter button
    4. Notice you are on page 3 where there is only 1 page?

    Cheers,
    Timothy
  2. #2

    RE: [CLOSED] PagingToolbar

    Hi,

    I don't think that it is a bug. You should manually to set required page. The grid/store don't know about paging. PagingToolbar just send page number with request. Therefore you need to change active page in PagingToolbar manually


    Store1.DataBind();
    PagingToolbar1.PageIndex = 1;
  3. #3

    RE: [CLOSED] PagingToolbar

    Sounds good -- I'm already doing the suggestion just noticed it and thought it was silly.

    Cheers
  4. #4

    RE: [CLOSED] PagingToolbar

    When i set the PagingToolbar1.PageIndex = 1; the store OnRefreshData event will excute twice.

Similar Threads

  1. [CLOSED] Pagingtoolbar MVC
    By webppl in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 22, 2011, 9:20 AM
  2. [CLOSED] PagingToolbar and Ajax
    By wazige in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 08, 2010, 1:52 PM
  3. [CLOSED] [1.0] GridPanel and PagingToolbar bug
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 23, 2010, 4:48 PM
  4. [CLOSED] PagingToolBar problem
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 23, 2009, 5:29 AM
  5. [CLOSED] PagingToolBar
    By Rod in forum 1.x Help
    Replies: 4
    Last Post: Oct 03, 2008, 8:43 AM

Posting Permissions