new GroupColumn()
分组列,只用于对普通列进行分组,不能用使用排序、编辑等功能
Example
var column1 = new ht.ui.Column(); // init column1 var column2 = new ht.ui.Column(); // init column2 var groupColumn = new ht.ui.GroupColumn(); groupColumn.setName('Group Column'); groupColumn.addChild(column1); groupColumn.addChild(column2); columnModel.add(column1); columnModel.add(column2); columnModel.add(groupColumn);
Extends
Methods
-
addChild(column)
-
增加子列
Parameters:
Name Type Description column
ht.ui.Column 被嵌套的列
-
formatValue(value, data) → {Object}
-
将要显示的值传入此方法格式化处理并返回,一般用于将数字转换更易读的文本格式
Parameters:
Name Type Description value
Object 格式化之前值
data
ht.Data 数据元素
- Inherited From:
Returns:
格式化之后的值
- Type
- Object
-
getAccessType() → {String|null}
-
获取列的属性类型,值列表如下:
- null: 默认类型,如 name 为 age,采用g etAge() 和 setAge(98) 的 get/set 或 is/set 方式存取
- style: 如 name 为 age,采用 getStyle('age') 和 setStyle('age', 98) 的方式存取
- field:如 name 为age,采用 data.age 和 data.age = 98 的方式存取
- attr:如 name 为 age,采用 getAttr('age') 和 setAttr('age', 98) 的方式存取
- Inherited From:
Returns:
- Type
- String | null
-
getAlign() → {String}
-
获取文字(表头和内容)的水平对齐方式,可用值有 left|right|center,默认为 left
- Inherited From:
Returns:
- Type
- String
-
getEditorClass() → {String|function}
-
获取列的编辑类, 如 'ht.editor.StringEditor'
- Inherited From:
Returns:
编辑器类或类名
- Type
- String | function
-
getFixed() → {String}
-
获取锁定方式
- Inherited From:
Returns:
- Type
- String
-
getPaddingLeft() → {Number}
-
获取列左侧内边距
- Inherited From:
Returns:
左侧内边距
- Type
- Number
-
getPaddingRight() → {Number}
-
获取列右侧内边距
- Inherited From:
Returns:
右侧内边距
- Type
- Number
-
getSortFunc() → {function}
-
获取排序函数
- Inherited From:
Returns:
排序函数
- Type
- function
-
getSortOrder() → {String}
-
获取排序状态
- asc: 升序
- desc: 降序
- Inherited From:
Returns:
- Type
- String
-
getSummary() → {String}
-
获取统计方式
- Inherited From:
Returns:
统计方式
- Type
- String
-
getToolTip(data, tableView) → {String}
-
获取提示文字
Parameters:
Name Type Description data
ht.Data 数据元素
tableView
ht.ui.TableView 视图对象
- Inherited From:
Returns:
- Type
- String
-
getValue(data, column, view) → {Object}
-
自定义要显示的单元格内容
Parameters:
Name Type Description data
ht.Data 数据元素
column
ht.ui.Column 列
view
ht.View 视图组件
- Inherited From:
Returns:
自定义的显示内容
- Type
- Object
-
getValueType() → {String}
-
获取值类型,值类型用于提示组件提供合适的 renderer 渲染
- null:默认类型,显示为文本方式
- string:字符串类型,显示为文本方式
- boolean:布尔类型,显示为勾选框
- color:颜色类型,以填充背景色的方式显示
- int:整型类型,文本编辑器改变值时自动通过 parseInt 进行转换
- number:浮点数类型,文本编辑器改变值时自动通过 parseFloat 转换
- Inherited From:
Returns:
- Type
- String
-
getWidth() → {Number}
-
获取列宽度, 默认为 80
- Inherited From:
Returns:
宽度值
- Type
- Number
-
isBatchEditable() → {Boolean}
-
判断该列是否允许多选时批量编辑
- Inherited From:
Returns:
是否可批量编辑
- Type
- Boolean
-
isEditable(data) → {Boolean}
-
判断此列是否可编辑
Parameters:
Name Type Description data
ht.Data 数据元素
- Inherited From:
Returns:
是否可编辑
- Type
- Boolean
-
isSortable() → {Boolean}
-
判断当前列是否可排序
- Inherited From:
Returns:
是否可排序
- Type
- Boolean
-
isVisible() → {Boolean}
-
判断当前列是否是否可见
- Inherited From:
Returns:
是否可见
- Type
- Boolean
-
removeChild(column)
-
删除子列
Parameters:
Name Type Description column
ht.ui.Column 被嵌套的列
-
setAccessType(accessType)
-
设置列的属性类型,可选值如下:
- null: 默认类型,如 name 为 age,采用 getAge() 和 setAge(98) 的 get/set 或 is/set 方式存取
- style: 如 name 为 age,采用 getStyle('age') 和 setStyle('age', 98) 的方式存取
- field:如 name 为 age,采用 data.age 和 data.age = 98 的方式存取
- attr:如 name 为 age,采用 getAttr('age') 和 setAttr('age', 98) 的方式存取
Parameters:
Name Type Description accessType
String - Inherited From:
-
setAlign(align)
-
设置文字的水平对齐方式,可用值有 left|right|center,默认为 left
Parameters:
Name Type Description align
String 对齐方式
- Inherited From:
-
setBatchEditable(batchEditable)
-
设置列是否允许多选时批量编辑
Parameters:
Name Type Description batchEditable
Boolean 是否可批量编辑
- Inherited From:
-
setEditable(editable)
-
设置此列是否可编辑
Parameters:
Name Type Description editable
Boolean 是否可编辑
- Inherited From:
-
setEditorClass(editorClass)
-
设置列的编辑类, 如 'ht.editor.StringEditor'
Parameters:
Name Type Description editorClass
String | function 编辑器类或类名
- Inherited From:
-
setFixed(fixed)
-
设置锁定方式;锁定列固定显示在表格左侧或右侧,不会跟随横向滚动条滚动
Parameters:
Name Type Description fixed
String 'left' 或者 'right'
- Inherited From:
-
setPaddingLeft(paddingLeft)
-
设置列左侧内边距
Parameters:
Name Type Description paddingLeft
Number 左侧内边距
- Inherited From:
-
setPaddingRight(paddingRight)
-
获取列右侧内边距
Parameters:
Name Type Description paddingRight
Number 右侧内边距
- Inherited From:
-
setSortable(sortable)
-
设置列是否可排序
Parameters:
Name Type Description sortable
Boolean 是否允许排序
- Inherited From:
-
setSortFunc(func)
-
设置排序函数
Parameters:
Name Type Description func
function 排序函数
- Inherited From:
-
setSortOrder(sortOrder)
-
设置排序状态
- asc: 升序
- desc: 降序
Parameters:
Name Type Description sortOrder
String - Inherited From:
-
setSummary(summary)
-
设置统计方式;统计数据显示在 TableFooter 组件中
Parameters:
Name Type Description summary
String 统计方式,支持:sum|min|max|average|first
- Inherited From:
-
setValueType(type)
-
设置值类型,值类型用于提示组件提供合适的 renderer 渲染
- null:默认类型,显示为文本方式
- string:字符串类型,显示为文本方式
- boolean:布尔类型,显示为勾选框
- color:颜色类型,以填充背景色的方式显示
- int:整型类型,文本编辑器改变值时自动通过 parseInt 进行转换
- number:浮点数类型,文本编辑器改变值时自动通过 parseFloat 转换
Parameters:
Name Type Description type
String 值类型
- Inherited From:
-
setVisible(visible)
-
设置列是否是否可见
Parameters:
Name Type Description visible
Boolean 是否可见
- Inherited From:
-
setWidth(width)
-
设置列宽度
Parameters:
Name Type Description width
Number 宽度值,如果值为负数表示占据表格剩余空间的百分比,如 -0.1,表示当前列的宽度为表格剩余宽度的百分之十
- Inherited From: