Originally Posted by
Daniil
Hi,
I'm still unable to run your code because it's depend on database. But I understood where the problem is.
Please use the following workaround (see //Workaround comment in code behind)
Example
<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script runat="server">
public List<object> MyData = new List<object>
{
new {test = "test1"},
new {test = "test2"},
new {test = "test3"},
new {test = "test4"},
new {test = "test5"},
new {test = "test6"},
new {test = "test7"},
new {test = "test8"},
new {test = "test9"}
};
protected void Page_Load(object sender, EventArgs e)
{
if (!Ext.IsAjaxRequest)
{
this.Store1.DataSource = MyData;
this.Store1.DataBind();
}
}
protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
this.Store1.DataSource = MyData;
this.Store1.DataBind();
PagingToolbar1.SetPageIndex(PagingToolbar1.PageIndex); //Workaround
}
</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 runat="server">
<title>Coolite 0.8.x Example</title>
</head>
<body>
<form runat="server">
<ext:ScriptManager runat="server" />
<ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="test" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="3" Mode="Raw" />
</BaseParams>
<WriteBaseParams>
<ext:Parameter Name="test" Value="Hello!" Mode="Value" />
</WriteBaseParams>
</ext:Store>
<ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel runat="server">
<Columns>
<ext:Column Header="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>
Hi,
I created a grid view in Coolite.Ext. It consists PagingToolBAr. It displays 3 records in each page
in grid view. Let us consider, we are seeing second page data. Now, we press refresh button in PagingToolbar then
automatically, it displys first page data. If we viewing , 20 th page in project, then it redirect to first page means
it is a big problem to user. But in Ext.Net version 1.0 it is working properly, we are using Coolite 0.8, so solve as early as possible.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Employe.aspx.cs" Inherits="ComboSearch.Employe" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script runat="server">
public List<object> MyData = new List<object>
{
new {test = "test1"},
new {test = "test2"},
new {test = "test3"},
new {test = "test4"},
new {test = "test5"},
new {test = "test6"},
new {test = "test7"},
new {test = "test8"},
new {test = "test9"}
};
protected void Page_Load(object sender, EventArgs e)
{
if (!Ext.IsAjaxRequest)
{
this.Store1.DataSource = MyData;
this.Store1.DataBind();
}
}
protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
this.Store1.DataSource = MyData;
this.Store1.DataBind();
PagingToolbar1.SetPageIndex(PagingToolbar1.PageIndex); //Workaround
}
</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 runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="test" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="limit" Value="3" Mode="Raw" />
</BaseParams>
<WriteBaseParams>
<ext:Parameter Name="test" Value="Hello!" Mode="Value" />
</WriteBaseParams>
</ext:Store>
<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>