还是基础的东西,grid全选没有事件,给加个事件,除了需要会复制粘贴外还要点推荐那!
1 $('#Grid1').find('.x-column-header.x-column-header-checkbox').on('click', function () {});
1 if (EnableRowSelectEvent)2 {3 string validateScript = "var args='RowSelect$'+index;";4 validateScript += GetPostBackEventReference("#RowSelect#").Replace("'#RowSelect#'", "args");5 string rowSelectScript = JsHelper.GetFunction(validateScript, "model", "record", "index"); //String.Format("function(model,rowIndex){{{0}}}", validateScript);6 selectOB.Listeners.AddPRoperty("select", rowSelectScript, true);7 }
不用解释也应该能看出来,上面触发select的js 代码就是这样输出的。再点查询,又找到一个
1 else if (eventArgument.StartsWith("RowSelect$"))2 {3 string[] commandArgs = eventArgument.Split('$');4 if (commandArgs.Length == 2)5 {6 OnRowSelect(new GridRowSelectEventArgs(Convert.ToInt32(commandArgs[1])));7 }8 }
1 else if (eventArgument.StartsWith("RowAllSelect$"))2 {3 string[] commandArgs = eventArgument.Split('$');4 if (commandArgs.Length == 2)5 {6 OnRowAllSelect(new GridRowAllSelectEventArgs(bool.Parse(commandArgs[1].ToString())));7 }8 }
1 #region OnRowAllSelect 2 private static readonly object _rowAllSelectHandlerKey = new object(); 3 /// <summary> 4 /// 头部全选事件(需要启用EnableRowAllSelect) 5 /// </summary> 6 [Category(CategoryName.ACTION)] 7 [Description("头部全选事件(需要启用EnableRowAllSelect)")] 8 public event EventHandler<GridRowAllSelectEventArgs> RowAllSelect 9 {10 add11 {12 Events.AddHandler(_rowAllSelectHandlerKey, value);13 }14 remove15 {16 Events.RemoveHandler(_rowAllSelectHandlerKey, value);17 }18 }19 /// <summary>20 /// 触发行选中事件21 /// </summary>22 /// <param name="e">事件参数</param>23 protected virtual void OnRowAllSelect(GridRowAllSelectEventArgs e)24 {25 EventHandler<GridRowAllSelectEventArgs> handler = Events[_rowAllSelectHandlerKey] as EventHandler<GridRowAllSelectEventArgs>;26 if (handler != null)27 {28 handler(this, e);29 }30 }31 #endregion
还有哪个有波浪?GridRowAllSelectEventArgs 没有接着建,新建cs文件,把GridRowSelectEventArgs复制过来,不要忘了写上署名
1 #region Comment 2 /* 3 * Project: FineUI 4 * 5 * FileName: GridRowAllSelectEventArgs.cs 6 * CreatedOn: 2015-10-14 7 * CreatedBy: 没想好 935732994@QQ.com 8 * 9 * 10 * Description:11 * ->12 * 13 * History:14 * ->15 * 16 * 17 * 18 * 19 */20 #endregion21 using System;22 using System.Data;23 using System.Reflection;24 using System.ComponentModel;25 using System.Web.UI;26 namespace FineUI27 {28 /// <summary>29 /// 表格行选中事件参数30 /// </summary>31 public class GridRowAllSelectEventArgs : EventArgs32 {33 private bool _boolall;34 /// <summary>35 /// 选中状态36 /// </summary>37 public bool boolall38 {39 get { return _boolall; }40 set { _boolall = value; }41 }42 /// <summary>43 /// 构造函数44 /// </summary>45 /// <param name="rowIndex">选中状态</param>46 public GridRowAllSelectEventArgs(bool boolall)47 {48 _boolall = boolall;49 }50 }51 }
新闻热点
疑难解答