[ExtNet] GridPanel怎么实现服务器端分页、排序、查询?--Oracel存储过程分页
A.前端aspx文件
i.store定义 [html]
<ext:Store ID="StoreIma" runat="server" OnRefreshData="StoreIma_OnRefreshData">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="ID" Mapping="ID" Type="String" />
<ext:RecordField Name="RANDOM_STRING" Mapping="RANDOM_STRING" Type="String" />
</Fields>
</ext:JsonReader>
</Reader>
<Proxy>
<ext:PageProxy>
</ext:PageProxy>
</Proxy>
</ext:Store>
<ext:Store ID="StoreIma" runat="server" OnRefreshData="StoreIma_OnRefreshData">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="ID" Mapping="ID" Type="String" />
<ext:RecordField Name="RANDOM_STRING" Mapping="RANDOM_STRING" Type="String" />
</Fields>
</ext:JsonReader>
</Reader>
<Proxy>
<ext:PageProxy>
</ext:PageProxy>
</Proxy>
</ext:Store> ii.Gridpanel定义
[html]
<ext:GridPanel ID="GpItem" runat="server" Width="1024" Height="500" StripeRows="true" StoreID="StoreIma">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="ID号" DataIndex="ID" Width="120">
</ext:Column>
<ext:Column Header="RANDOM_STRING" DataIndex="RANDOM_STRING" Width="320">
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<LoadMask ShowMask="true" />
<BottomBar>
<ext:PagingToolbar ID="PagingToolBar1" StoreID="StoreIma" PageSize="100" runat="server" />
</BottomBar>
</ext:GridPanel>
<ext:GridPanel ID="GpItem" runat="server" Width="1024" Height="500" StripeRows="true" StoreID="StoreIma">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="ID号" DataIndex="ID" Width="120">
</ext:Column>
<ext:Column Header="RANDOM_STRING" DataIndex="RANDOM_STRING" Width="320">
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<LoadMask ShowMask="true" />
<BottomBar>
<ext:PagingToolbar ID="PagingToolBar1" StoreID="StoreIma" PageSize="100" runat="server" />
</BottomBar>
</ext:GridPanel>B.后端aspx.cs文件
[csharp] view plaincopyprint?
protected void StoreIma_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
{
int PageSize = this.PagingToolBar1.PageSize; //获取当前在页面中PagingToolBar 的PageSize的值
int Count = 0;
int CurPage = e.Start / PageSize + 1; //获取当前的页码是多少,也就是第几页
var store = this.GpItem.GetStore();
Model.PageBar page = new Model.PageBar();
page.Tables = "myTestTable";
page.Filter = " 1=1 ";
page.PrimaryKey = "ID";
page.Sort = "ASC";
page.CurrentPage = CurPage; 补充:Web开发 , ASP.Net ,