[CLOSED] [1.0] Paging not applied to Grid when loading data via DirectEvent

  1. #1

    [CLOSED] [1.0] Paging not applied to Grid when loading data via DirectEvent

    In the following example, when you click on the "Load Data" button, the data in the grid isn't paged. This only seems to happen when loading data via a DirectEvent. If the data was loaded in the initial page load, paging is correctly applied to the grid.

    Thanks

    Dan

    ASPX
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
    <%@ OutputCache Location="None" VaryByParam="None"%>
    
    <!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 runat="server" id="ttlMain"></title>
    </head>
    <body runat="server" id="bodyMain"> 
        <form id="frmMain" runat="server">
            <ext:ResourceManager runat="server" ID="rsmMain">
                
            </ext:ResourceManager>
            
            <ext:GridPanel runat="server" Width="800" Height="600">
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button runat="server" Text="Load Data" Icon="Application">
                                <DirectEvents>
                                    <Click OnEvent="btnLoad_Click"></Click>
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Store>
                    <ext:Store runat="server" id="strData">
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="RecordName"></ext:RecordField>
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel>
                    <Columns>
                        <ext:Column Header="Record Name" DataIndex="RecordName" Width="750"></ext:Column>
                    </Columns>
                </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="5">
                        
                    </ext:PagingToolbar>
                </BottomBar>
            </ext:GridPanel>
    
        </form>
    </body>
    </html>
    Code-behind:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using Ext.Net; 
    
    public partial class Default4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
    
        protected void btnLoad_Click(object sender, DirectEventArgs e)
        {
            List<Record> opData = new List<Record>();
            opData.Add(new Record() { RecordName = "Test1" });
            opData.Add(new Record() { RecordName = "Test2" });
            opData.Add(new Record() { RecordName = "Test3" });
            opData.Add(new Record() { RecordName = "Test4" });
            opData.Add(new Record() { RecordName = "Test5" });
            opData.Add(new Record() { RecordName = "Test6" });
            opData.Add(new Record() { RecordName = "Test7" });
            opData.Add(new Record() { RecordName = "Test8" });
            opData.Add(new Record() { RecordName = "Test9" });
            opData.Add(new Record() { RecordName = "Test10" });
            opData.Add(new Record() { RecordName = "Test11" });
            opData.Add(new Record() { RecordName = "Test12" });
            opData.Add(new Record() { RecordName = "Test13" });
            opData.Add(new Record() { RecordName = "Test14" });
    
            strData.DataSource = opData;
            strData.DataBind();
        }
    
        private class Record
        {
            public string RecordName { get; set; }
        }
    }
    Last edited by Daniil; Mar 24, 2011 at 2:39 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please add <BaseParams> for the Store.
    <BaseParams>
        <ext:Parameter Name="start" Value="0" Mode="Raw" />
        <ext:Parameter Name="limit" Value="5" Mode="Raw" />
    </BaseParams>
  3. #3
    Hi,

    Thanks, but I've applied that code and it makes no difference...

    Dan
  4. #4
    Hi,

    Apologize, please replace BaseParams with AutoLoadParams.

    Actually, with AutoLoadParams the PagingTollbar doesn't know anything how to "page" data.
  5. #5
    Thanks, that sorted it.

Similar Threads

  1. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  2. [CLOSED] Loading Mask Before data bind to grid
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Apr 27, 2011, 12:22 PM
  3. [CLOSED] [1.0] Gridview local data paging with remote data
    By BerndDA in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 15, 2010, 10:29 AM
  4. Replies: 5
    Last Post: Jul 10, 2010, 10:33 AM
  5. [CLOSED] something is missing. Grid not loading data from List<>
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 14, 2009, 11:57 AM

Posting Permissions