Exemple #1
0
        /// <summary>
        /// 向表格加入一个列
        /// </summary>
        /// <param name="field">列名称</param>
        /// <param name="title">标题</param>
        /// <param name="align">对齐</param>
        /// <param name="width">宽</param>
        /// <param name="editor">编辑器表达式</param>
        /// <param name="formatter">自定义显示格式化函数</param>
        /// <returns></returns>
        public DataGridBuilder AddColumn(string field, string title = null, string align = null, int?width = null, string editor = null, string formatter = null)
        {
            GridColumnBuilder columnBuilder = new GridColumnBuilder();

            columnBuilder.Field(field);
            columnBuilder.Title(title ?? field);
            columnBuilder.Align(align);
            if (width != null)
            {
                columnBuilder.Width(width.Value);
            }
            if (editor != null)
            {
                columnBuilder.Editor(editor);
            }
            if (formatter != null)
            {
                columnBuilder.Formatter(formatter);
            }
            return(AddColumn(columnBuilder));
        }
Exemple #2
0
 /// <summary>
 /// 向表格加入一个列
 /// </summary>
 /// <param name="columnBuilder"></param>
 /// <returns></returns>
 public DataGridBuilder AddColumn(GridColumnBuilder columnBuilder)
 {
     columns.Add(columnBuilder);
     return(this);
 }