Problem with paging toolbar

  1. #1

    Problem with paging toolbar

    Hi Everyone,

    I have a problem and need your help.
    I have a search result in a GridPanel. if I select a record that is on a page > 1, then select the record to view detail ( navigate to the second page), and go back to the search result page, the system returns me to page 1. Can it return to the page I was on when I selected the record?

    Thank you.
    Last edited by sonnh11; May 06, 2011 at 4:34 PM.
  2. #2
    Hi,

    Please provide a simplified sample to run and test.
  3. #3
    This is a simplified sample to run and test :
    Default.aspx page:
    <%@ 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)
            {
                this.Store1.DataSource = this.Data;
                this.Store1.DataBind();
            }
        }
        
        private object[] Data
        {
            get
            {
                return new object[]
                {
                    new object[] { 1,"3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                    new object[] { 2,"2,Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                    new object[] { 3,"Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
                    new object[] { 4,"American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
                    new object[] { 5,"American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
                    new object[] { 6,"AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
                    new object[] { 7,"Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
                    new object[] { 8,"Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
                    new object[] { 9,"Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am" },
                    new object[] { 10,"E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am" },
                    new object[] { 11,"Exxon Mobil Corp", 68.1, -0.43, -0.64, "9/1 12:00am" },
                    new object[] { 12,"General Electric Company", 34.14, -0.08, -0.23, "9/1 12:00am" },
                    new object[] { 13,"General Motors Corporation", 30.27, 1.09, 3.74, "9/1 12:00am" },
                    new object[] { 14,"Hewlett-Packard Co.", 36.53, -0.03, -0.08, "9/1 12:00am" },
                    new object[] { 15,"Honeywell Intl Inc", 38.77, 0.05, 0.13, "9/1 12:00am" },
                   
                };
            }
        }
    </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 id="Head1" runat="server">
        <title>Simple Array Grid - Ext.NET Examples</title>
        <script type="text/javascript">
            var template = '<span style="color:{0};">{1}</span>';
    
            var change = function (value) {
                return String.format(template, (value > 0) ? "green" : "red", value);
            };
    
            var pctChange = function (value) {
                return String.format(template, (value > 0) ? "green" : "red", value + "%");
            };
    
            var renderLink = function(value, rec) {
            return String.format("<a href='detail.aspx?Name={0}'>{0}</a>", value);
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
        <h1>Simple Array Grid</h1>
        
        <ext:GridPanel 
            ID="GridPanel1"
            runat="server" 
            StripeRows="true"
            Title="Array Grid" 
            TrackMouseOver="true"
            Width="600" 
            Height="250"
            AutoExpandColumn="company">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="id" />
                                <ext:RecordField Name="company" />
                                <ext:RecordField Name="price" Type="Float" />
                                <ext:RecordField Name="change" Type="Float" />
                                <ext:RecordField Name="pctChange" Type="Float" />
                                <ext:RecordField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column ColumnID="Company" Header="Company" DataIndex="company" >
                       <Renderer Fn ="renderLink" />
                    </ext:Column>
                    <ext:Column Header="Price" DataIndex="price">                  
                        <Renderer Format="UsMoney" />
                    </ext:Column>
                    <ext:Column ColumnID="Change" Header="Change" DataIndex="change">
                        <Renderer Fn="change" />
                    </ext:Column>
                    <ext:Column Header="Change" DataIndex="pctChange">
                        <Renderer Fn="pctChange" />
                    </ext:Column>
                    <ext:DateColumn Header="Last Updated" DataIndex="lastChange" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
            </SelectionModel>
            <BottomBar>
                <ext:PagingToolbar runat="server" PageSize="5" ></ext:PagingToolbar>
            </BottomBar>
        </ext:GridPanel>
    </body>
    And Detail.aspx page :
    <%@ 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)
            {
               lblCompanyName.Text = Request .QueryString ["Name"];
            }
        }  
        
    </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 id="Head1" runat="server">
        <title>Simple Array Grid - Ext.NET Examples</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>Detail Page</h1>
        <br />    
        Company name : <ext:Label runat="server" ID="lblCompanyName" ></ext:Label>
        <br />
        <br />
        <a href ="javascript:history.back(-1)">Back</a>
        
    </body>
    </html>
    Thank you.
  4. #4
    Thanks for the sample, the requirement is clear now.

    You should be able to save (for example, in cookies) an active page before redirecting, and restore it after .back().

Similar Threads

  1. Replies: 11
    Last Post: Jun 13, 2012, 5:53 PM
  2. Error with the Paging Toolbar?
    By omeszar in forum 1.x Help
    Replies: 8
    Last Post: Mar 20, 2012, 11:56 AM
  3. Paging ToolBar Problem
    By kiran malgi in forum 1.x Help
    Replies: 2
    Last Post: Mar 29, 2010, 9:25 AM
  4. paging toolbar on extjs
    By [WP]joju in forum 1.x Help
    Replies: 4
    Last Post: Oct 22, 2009, 9:21 AM
  5. paging toolbar caching
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Oct 20, 2009, 10:36 AM

Posting Permissions