View on GitHub
表格分组 v2
Bootstrap Table 的分组扩展 v2。
使用方法
<link rel="stylesheet" href="extensions/group-by-v2/bootstrap-table-group-by.css">
<script src="extensions/group-by-v2/bootstrap-table-group-by.js"></script>
示例
选项
groupBy
-
attribute:
data-group-by
-
type:
Boolean
-
Detail:
设置为 true 以按传入的字段对数据进行分组。
-
Default:
false
groupByField
-
attribute:
data-group-by-field
-
type:
String|Array
-
Detail:
设置要分组的字段名称。 对于单个字段,使用
String
,例如shape
。 对于多个字段,使用Array
,例如["shape", "color"]
。 -
Default:
''
groupByFormatter
-
attribute:
data-group-by-formatter
-
type:
Function
-
Detail:
分组行格式化函数,接受三个参数:
value
: the group by value.idx
: the index of the group.data
: an array of rows in the group.
-
Default:
undefined
groupByToggle
-
attribute:
data-group-by-toggle
-
type:
Boolean
-
Detail:
设置为
true
以允许折叠/展开分组。 -
Default:
false
groupByShowToggleIcon
-
attribute:
data-group-by-show-toggle-icon
-
type:
Boolean
-
Detail:
设置为
true
以在分组折叠或展开时显示图标(参见 groupByToggle)。 -
Default:
false
groupByCollapsedGroups
-
attribute:
data-group-by-collapsed-groups
-
type:
Array|Function
-
Detail:
默认情况下将折叠此数组中的所有分组键。 此选项的值可以是:
- 一个变量(数组)
- 一个字符串数组,例如
["circle"]
- 一个函数(返回数组),接收以下参数:
- 分组键
- 分组的条目
-
Default:
[]