Skip to content

Commit 0770bcd

Browse files
committed
Enhance group-by-v2 example with full configuration
* Implement groupBy functionality with custom formatter * Add sortable columns for shape, color, and area * Include checkbox selection for state field
1 parent 5958310 commit 0770bcd

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

extensions/group-by-v2.html

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,40 @@
1414
</script>
1515

1616
<template>
17-
<table
18-
id="table"
19-
data-group-by="true"
20-
data-group-by-field="shape"
21-
data-url="json/data6.json"
22-
>
23-
<thead>
24-
<tr>
25-
<th data-field="shape">
26-
Shape
27-
</th>
28-
<th data-field="color">
29-
Color
30-
</th>
31-
<th data-field="area">
32-
Area
33-
</th>
34-
</tr>
35-
</thead>
36-
</table>
17+
<table id="table"></table>
3718
</template>
3819

3920
<script>
4021
function mounted () {
41-
$('#table').bootstrapTable()
22+
$('#table').bootstrapTable({
23+
url: 'json/data6.json',
24+
groupBy: true,
25+
groupByField: 'shape',
26+
groupByFormatter: value => $('<strong>')
27+
.addClass('text-primary')
28+
.text(`GROUP: ${value}`)[0]
29+
.outerHTML,
30+
columns: [
31+
{
32+
field: 'state',
33+
checkbox: true
34+
},
35+
{
36+
field: 'shape',
37+
title: 'Shape',
38+
sortable: true
39+
},
40+
{
41+
field: 'color',
42+
title: 'Color',
43+
sortable: true
44+
},
45+
{
46+
field: 'area',
47+
title: 'Area',
48+
sortable: true
49+
}
50+
]
51+
})
4252
}
4353
</script>

0 commit comments

Comments
 (0)