fineui排序问题
Posted 打你一下
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了fineui排序问题相关的知识,希望对你有一定的参考价值。
后台:
private void BindGrid()
{
// 1.获取当前分页数据
DataSet dataSet = GetPagedDataTable();
// 2.绑定到Grid
Grid1.DataSource = dataSet.Table1();
string sortField = this.Grid1.SortField;
//string sortDirection = this.;
BindGridWithSort(sortField, Grid1.SortDirection);
Grid1.DataBind();
}
private void BindGridWithSort(string sortField, string sortDirection)
{
DataSet dataSet = GetPagedDataTable();
DataTable table = dataSet.Table1();
DataView view1 = table.DefaultView;
view1.Sort = String.Format("{0} {1}", sortField, sortDirection);
Grid1.DataSource = view1;
Grid1.DataBind();
}
protected void Grid1_Sort(object sender, FineUI.GridSortEventArgs e)
{
this.Grid1.SortDirection = e.SortDirection;
this.Grid1.SortField = e.SortField;
this.BindGrid();
}
前端:
<f:Grid ID="Grid1" Title="Grid1" PageSize="15" ShowBorder="true" BoxFlex="1" AllowPaging="true" Width="470px" Height="600px"
AllowSorting="true" OnPageIndexChange="Grid1_PageIndexChange" ShowHeader="false"
runat="server" EnableCheckBoxSelect="True" DataKeyNames="ID,BrandCode,isshenhe,isshouquan,img,AttchFJ"
IsDatabasePaging="true" SortField="UserCode" SortDirection="DESC" OnSort="Grid1_Sort"
OnRowCommand="Grid1_RowCommand">
以上是关于fineui排序问题的主要内容,如果未能解决你的问题,请参考以下文章