[CLOSED] Proxy Handler start twice when in C# we are change PageIndex

  1. #1

    [CLOSED] Proxy Handler start twice when in C# we are change PageIndex

    For example we have proxy method: https://examples1.ext.net/#/GridPane...rting/Handler/

    Now I will supplement some parts of the code:

    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Store1.BaseParams["session_name"] = "test";
            this.PagingToolbar1.PageIndex = 2;
            this.CheckboxSelectionModel1.SelectedRows.AddRange(
                new SelectedRowCollection()
                {
                    new SelectedRow("3"),
                    new SelectedRow("5"),
                    new SelectedRow("7"),
                    new SelectedRow("10"),
                    new SelectedRow("15")
                }
            );
        }
        
    </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>Ext.Net Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:GridPanel runat="server" ID="GridPanelMain" SelectionMemory="Enabled"
                AutoExpandColumn="Common" 
                Height="300">
               <Store>
                    <ext:Store ID="Store1" runat="server">
                        <Proxy>
                            <ext:HttpProxy Method="GET" Url="~/Handler1.ashx" />
                        </Proxy>
                        <%--<BaseParams>
                            <ext:Parameter Name="session_name" />
                        </BaseParams>--%>
                        <AutoLoadParams>
                            <ext:Parameter Name="start" Value="0" Mode="Raw" />
                            <ext:Parameter Name="limit" Value="5" Mode="Raw" />
                            <ext:Parameter Name="sort" Value="" />
                            <ext:Parameter Name="dir" Value="" />
                        </AutoLoadParams>
                        <Reader>
                            <ext:JsonReader Root="Data" TotalProperty="TotalRecords" IDProperty="ID">
                                <Fields>
                                    <ext:RecordField Name="ID" Type="Int" />
                                    <ext:RecordField Name="Common" />
                                    <ext:RecordField Name="Botanical" />
                                    <ext:RecordField Name="Light" />
                                    <ext:RecordField Name="Price" Type="Float" />
                                    <ext:RecordField Name="Availability" Type="Date" />
                                    <ext:RecordField Name="Indoor" Type="Boolean" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                        <SortInfo Field="Common" Direction="ASC" />
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:NumberColumn ColumnID="ID" Header="ID" DataIndex="ID" Width="50" />
                        <ext:Column ColumnID="Common" Header="Common Name" DataIndex="Common" Width="220" Sortable="true" />
                        <ext:Column Header="Botanical" DataIndex="Botanical" Width="230" />
                        <ext:Column Header="Light" DataIndex="Light" Width="130" />
                        <ext:Column Header="Price" DataIndex="Price" Width="70" Align="right" />
                        <ext:DateColumn Header="Available" DataIndex="Availability" Width="95" Format="yyyy-MM-dd" />
                        <ext:Column Header="Indoor?" DataIndex="Indoor" Width="55" />
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" SingleSelect="false" />
                </SelectionModel>
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button runat="server" ID="button1" Text="Button">
                                <%--<DirectEvents>
                                    <Click OnEvent="button1_Click" />
                                </DirectEvents>--%>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>           
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="5" DisplayInfo="true" />
                </BottomBar>
                <LoadMask ShowMask="true" />
            </ext:GridPanel>
        </form>
    </body>
    </html>
    and Handler1.ashx.cs:
                System.Diagnostics.Debug.WriteLine("start:" + start.ToString());
                System.Diagnostics.Debug.WriteLine("limit:" + limit.ToString());
                System.Diagnostics.Debug.WriteLine("sort:" + sort.ToString());
                System.Diagnostics.Debug.WriteLine("dir:" + dir.ToString());
                System.Diagnostics.Debug.WriteLine("session_name:" + session_name.ToString());
    and Plant.cs:
        public class Plant
        {
            public int ID { get; set; }
    
            public static List<Plant> TestData
            {
                get
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(HttpContext.Current.Server.MapPath("Plants.xml"));
                    List<Plant> data = new List<Plant>();
                    IFormatProvider culture = new CultureInfo("en-US", true);
                    int i = 1;
                    foreach (XmlNode plantNode in xmlDoc.SelectNodes("catalog/plant"))
                    {
                        Plant plant = new Plant();
    
                        plant.ID = i++;
                        plant.Common = plantNode.SelectSingleNode("common").InnerText;
                        plant.Botanical = plantNode.SelectSingleNode("botanical").InnerText;
                        plant.Zone = plantNode.SelectSingleNode("zone").InnerText;
                        plant.ColorCode = plantNode.SelectSingleNode("colorCode").InnerText;
                        plant.Light = plantNode.SelectSingleNode("light").InnerText;
                        plant.Price = decimal.Parse(plantNode.SelectSingleNode("price").InnerText, culture);
                        plant.Availability = DateTime.Parse(plantNode.SelectSingleNode("availability").InnerText, culture);
                        plant.Indoor = bool.Parse(plantNode.SelectSingleNode("indoor").InnerText);
    
                        data.Add(plant);
                    }
    
                    return data;
                }
            }
        }
    When I am starting the example, it proxy loads twice
    We can trace it in Output window
    start:0
    limit:5
    sort:
    dir:
    session_name:test
    start:5
    limit:5
    sort:
    dir:
    session_name:test
    What it is possible to do, if only proxy only one time started itself?
    start:5
    limit:5
    sort:
    dir:
    session_name:test
    Last edited by Daniil; Aug 02, 2011 at 1:53 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You should be able to set up a respective "start".
    <ext:Parameter Name="start" Value="5" Mode="Raw" />
    instead of .PageIndex.

    Please use .PageIndex during DirectEvent only.

Similar Threads

  1. [CLOSED] Client side change component handler function....
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 24, 2012, 3:54 PM
  2. Replies: 2
    Last Post: Jun 03, 2012, 4:18 PM
  3. [CLOSED] PagingToolbar (pageindex) not updating
    By mcfromero in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Mar 20, 2012, 7:36 PM
  4. [CLOSED] [1.0] Change handler no longer working
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 12, 2011, 1:26 PM
  5. Replies: 1
    Last Post: May 18, 2010, 10:41 AM

Tags for this Thread

Posting Permissions