new TableHeader(tableView)
表头组件,常与TableView和TreeTableView结合呈现Column信息,并提供Column的排序、大小和位置变化等交互操作功能
Parameters:
Name | Type | Description |
---|---|---|
tableView |
ht.widget.TableView | ht.widget.TreeTableView | 表格组件 |
Methods
-
addPropertyChangeListener(listener, scope, ahead)
-
增加自身属性变化事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
- See:
-
addViewListener(listener, scope, ahead)
-
监听视图事件,如布局、刷新等
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
-
drawColumn(g, column, x, y, width, height)
-
绘制列头,可重载自定义
Parameters:
Name Type Description g
CanvasRenderingContext2D 画笔对象
column
ht.Column 列信息
x
Number 左上角x坐标
y
Number 左上角y坐标
width
Number 绘制的宽度
height
Number 绘制的高度
-
getCheckIcon() → {String}
-
返回check图标
Returns:
- Type
- String
-
getColumnLineColor() → {color}
-
获取列线颜色
Returns:
- Type
- color
-
getHeight() → {Number}
-
获取布局高度
Returns:
- Type
- Number
-
getIndent() → {Number}
-
获取缩进,一般当作列头图标的宽度
Returns:
- Type
- Number
-
getInsertColor() → {color}
-
获取移动列时可插入位置的提示颜色
Returns:
- Type
- color
-
getLabel(column) → {String}
-
获取列头文字信息,默认返回column.toLabel(),可重载自定义
Parameters:
Name Type Description column
ht.Column Returns:
- Type
- String
-
getLabelAlign() → {String}
-
获取列头文字水平对齐方式,默认会考虑column.getAlign()值,可重载自定义
Returns:
- Type
- String
-
getLabelColor(column) → {color}
-
获取列头文字颜色,默认会返回column.getColor()||tableHeader.getLabelColor();
Parameters:
Name Type Description column
ht.Column 列
Returns:
- Type
- color
-
getLabelFont(column) → {String}
-
获取列头文字字体,可重载自定义
Parameters:
Name Type Description column
ht.Column 列
Returns:
- Type
- String
-
getLogicalPoint(event) → {Object}
-
传入HTML事件对象,将事件坐标转换为组件中的逻辑坐标
Parameters:
Name Type Description event
Event 事件对象
- See:
Returns:
- Type
- Object
-
getMoveBackground() → {color}
-
获取移动列时的列头背景色
Returns:
- Type
- color
-
getSortAscIcon() → {String}
-
获取表头列升序图标
Returns:
- Type
- String
-
getSortDescIcon() → {String}
-
获取表头列降序图标
Returns:
- Type
- String
-
getTableView() → {ht.widget.TableView|ht.widget.TreeTableView}
-
获取绑定的表格组件
Returns:
-
getView() → {HTMLDivElement}
-
获取组件的根层div
Returns:
- Type
- HTMLDivElement
-
getWidth() → {Number}
-
获取布局宽度
Returns:
- Type
- Number
-
invalidate(delay)
-
无效组件,并调用延时刷新
Parameters:
Name Type Description delay
Number 延迟刷新的间隔事件(单位:ms)
- See:
-
isColumnLineVisible() → {Boolean}
-
获取列线是否可见,默认为true
Returns:
- Type
- Boolean
-
isDisabled() → {Boolean}
-
组件是否处于不可用状态,处于此状态时不能进行任何操作并且会遮挡一层蒙板
Returns:
- Type
- Boolean
-
isMovable() → {Boolean}
-
获取列顺序是否允许移动改变,默认为true
Returns:
- Type
- Boolean
-
isResizable() → {Boolean}
-
获取列宽是否允许改变,默认为true
Returns:
- Type
- Boolean
-
iv(delay)
-
无效组件,并调用延时刷新,invalidate的缩写
Parameters:
Name Type Description delay
Number 延迟刷新的间隔事件(单位:ms)
- See:
-
lp(event) → {Object}
-
传入HTML事件对象,将事件坐标转换为组件中的逻辑坐标,getLogicalPoint的缩写
Parameters:
Name Type Description event
Event 事件对象
- See:
Returns:
- Type
- Object
-
mp(listener, scope, ahead)
-
增加自身属性变化事件监听器,addPropertyChangeListener的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
-
removePropertyChangeListener(listener, scope)
-
删除自身属性变化事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
removeViewListener(listener, scope)
-
删除视图事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
setCheckIcon(icon)
-
设置check图标
Parameters:
Name Type Description icon
String -
setColumnLineColor(color)
-
设置列线颜色
Parameters:
Name Type Description color
color -
setColumnLineVisible(v)
-
设置列线是否可见
Parameters:
Name Type Description v
Boolean -
setDisabled(value, iconUrl)
-
设置组件是否处于不可用状态,处于不可用状态时不能进行任何操作并且会遮挡一层蒙板
Parameters:
Name Type Argument Description value
Boolean 是否禁用组件
iconUrl
String <optional>
蒙板上显示的icon的路径
-
setHeight(v)
-
设置布局高度
Parameters:
Name Type Description v
Number 高度值
-
setIndent(v)
-
设置缩进,一般当作列头图标的宽度
Parameters:
Name Type Description v
Number -
setInsertColor(color)
-
设置移动列时可插入位置的提示颜色
Parameters:
Name Type Description color
color -
setLabelColor(color)
-
设置列头文本颜色
Parameters:
Name Type Description color
color -
setLabelFont(font)
-
设置列头文本字体
Parameters:
Name Type Description font
String -
setMovable(movable)
-
设置列顺序是否允许移动改变,默认为true
Parameters:
Name Type Description movable
Boolean -
setMoveBackground(color) → {color}
-
设置移动列时的列头背景色
Parameters:
Name Type Description color
color Returns:
- Type
- color
-
setResizable(v)
-
设置列宽是否允许改变,默认为true
Parameters:
Name Type Description v
Boolean -
setSortAscIcon(icon)
-
设置表头列升序图标
Parameters:
Name Type Description icon
String -
setSortDescIcon(icon)
-
设置表头列降序图标
Parameters:
Name Type Description icon
String -
setWidth(v)
-
设置布局宽度
Parameters:
Name Type Description v
Number 宽度值
-
ump(listener, scope)
-
删除自身属性变化事件监听器,removePropertyChangeListener的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
validate()
-
立刻刷新组件