Jul 26, 2011, 12:09 PM
[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:
We can trace it in Output window
What it is possible to do, if only proxy only one time started itself?
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 twiceWe can trace it in Output window
start:0
limit:5
sort:
dir:
session_name:test
start:5
limit:5
sort:
dir:
session_name:test
limit:5
sort:
dir:
session_name:test
start:5
limit:5
sort:
dir:
session_name:test
start:5
limit:5
sort:
dir:
session_name:test
limit:5
sort:
dir:
session_name:test
Last edited by Daniil; Aug 02, 2011 at 1:53 PM.
Reason: [CLOSED]