From 50e0e555036cf631b3234c851702bfa643f6effd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E7=94=9F=E7=9F=B3=E4=B8=8A?= Date: Thu, 7 Dec 2017 21:12:33 +0800 Subject: [PATCH] =?UTF-8?q?-=E5=A2=9E=E5=8A=A0=E7=A4=BA=E4=BE=8B=EF=BC=9A?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=8E=A7=E4=BB=B6->=E6=8E=92=E5=BA=8F->?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=EF=BC=88=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=AB=AF?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=8E=92=E5=BA=8F=E5=88=97=EF=BC=89=EF=BC=88?= =?UTF-8?q?PLEaglefly-21456=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FineUI.Examples/FineUI.Examples.csproj | 8 ++ FineUI_v6/FineUI.Examples/common/menu.xml | 2 + .../grid/grid_sorting_server.aspx | 43 ++++++++++ .../grid/grid_sorting_server.aspx.cs | 66 ++++++++++++++++ .../grid/grid_sorting_server.aspx.designer.cs | 78 +++++++++++++++++++ .../FineUI/WebControls/PanelBase.Grid/Grid.cs | 17 +++- FineUI_v6/FineUI/release_history.txt | 3 +- 7 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx create mode 100644 FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.cs create mode 100644 FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.designer.cs diff --git a/FineUI_v6/FineUI.Examples/FineUI.Examples.csproj b/FineUI_v6/FineUI.Examples/FineUI.Examples.csproj index 1ae3fd6..5c510c2 100644 --- a/FineUI_v6/FineUI.Examples/FineUI.Examples.csproj +++ b/FineUI_v6/FineUI.Examples/FineUI.Examples.csproj @@ -134,6 +134,7 @@ + @@ -1032,6 +1033,13 @@ grid_rowexpander_grid_data.ashx + + grid_sorting_server.aspx + ASPXCodeBehind + + + grid_sorting_server.aspx + grid_sorting_nosortfield.aspx ASPXCodeBehind diff --git a/FineUI_v6/FineUI.Examples/common/menu.xml b/FineUI_v6/FineUI.Examples/common/menu.xml index 2562313..fbcacea 100644 --- a/FineUI_v6/FineUI.Examples/common/menu.xml +++ b/FineUI_v6/FineUI.Examples/common/menu.xml @@ -226,6 +226,8 @@ + + diff --git a/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx new file mode 100644 index 0000000..6c09f84 --- /dev/null +++ b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx @@ -0,0 +1,43 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="grid_sorting_server.aspx.cs" Inherits="FineUI.Examples.grid.grid_sorting_server" %> + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + diff --git a/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.cs b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.cs new file mode 100644 index 0000000..420e46a --- /dev/null +++ b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using System.Text; + +namespace FineUI.Examples.grid +{ + public partial class grid_sorting_server : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindGrid(); + } + } + + #region BindGrid + + private void BindGrid() + { + string sortField = Grid1.SortField; + string sortDirection = Grid1.SortDirection; + + DataTable table = DataSourceUtil.GetDataTable(); + + DataView view1 = table.DefaultView; + view1.Sort = String.Format("{0} {1}", sortField, sortDirection); + + Grid1.DataSource = view1; + Grid1.DataBind(); + } + + #endregion + + #region Events + + protected void Button1_Click(object sender, EventArgs e) + { + labResult.Text = HowManyRowsAreSelected(Grid1); + } + + protected void Grid1_Sort(object sender, GridSortEventArgs e) + { + //Grid1.SortDirection = e.SortDirection; + //Grid1.SortField = e.SortField; + + BindGrid(); + } + + + protected void Button2_Click(object sender, EventArgs e) + { + Grid1.SortDirection = "DESC"; + Grid1.SortField = "EntranceYear"; + + BindGrid(); + } + + #endregion + + } +} diff --git a/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.designer.cs b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.designer.cs new file mode 100644 index 0000000..53266b7 --- /dev/null +++ b/FineUI_v6/FineUI.Examples/grid/grid_sorting_server.aspx.designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FineUI.Examples.grid { + + + public partial class grid_sorting_server { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::FineUI.PageManager PageManager1; + + /// + /// Grid1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::FineUI.Grid Grid1; + + /// + /// Label2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// Button1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::FineUI.Button Button1; + + /// + /// Button2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::FineUI.Button Button2; + + /// + /// labResult control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::FineUI.Label labResult; + } +} diff --git a/FineUI_v6/FineUI/WebControls/PanelBase.Grid/Grid.cs b/FineUI_v6/FineUI/WebControls/PanelBase.Grid/Grid.cs index bbc4a2f..d95baaa 100644 --- a/FineUI_v6/FineUI/WebControls/PanelBase.Grid/Grid.cs +++ b/FineUI_v6/FineUI/WebControls/PanelBase.Grid/Grid.cs @@ -2147,7 +2147,7 @@ namespace FineUI //return jo; - + JArray ja = new JArray(); foreach (GridRow row in Rows) @@ -2812,6 +2812,21 @@ namespace FineUI //} + // 排序在服务器端发生变化 + // 或者:数据重新加载了,此时也需要重新设置排序列 + if (AllowSorting) + { + if (dataReloaded || PropertyModified("SortField") || PropertyModified("SortDirection")) + { + var sortFieldColumnId = GetSortColummID(); + if (!String.IsNullOrEmpty(sortFieldColumnId)) + { + sb.AppendFormat("{0}.f_setSortIcon('{1}','{2}');", XID, sortFieldColumnId, SortDirection); + } + } + } + + AddAjaxScript(sb); } diff --git a/FineUI_v6/FineUI/release_history.txt b/FineUI_v6/FineUI/release_history.txt index ccdffd4..0e247a1 100644 --- a/FineUI_v6/FineUI/release_history.txt +++ b/FineUI_v6/FineUI/release_history.txt @@ -29,7 +29,8 @@ FineUI 严格遵守 ExtJS 对开源软件的规定,不再内置 ExtJS 库, 发布历史 - -增加示例:表格控件->行与列样式->行样式(列锁定)。 + -增加示例:表格控件->行与列样式->行样式(列锁定)(vt4u-21458)。 + -增加示例:表格控件->排序->排序(服务器端改变排序列)(PLEaglefly-21456)。