Add support for "row status" in Buefy grid tables
This commit is contained in:
parent
24547b4fc5
commit
05b8ed7153
4 changed files with 30 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
:data="data"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:row-class="getRowClass"
|
||||
|
||||
:default-sort="[sortField, sortOrder]"
|
||||
backend-sorting
|
||||
|
@ -21,7 +22,8 @@
|
|||
|
||||
## TODO: should let grid (or master view) decide how to set these?
|
||||
icon-pack="fas"
|
||||
:striped="true"
|
||||
## note that :striped="true" was interfering with row status (e.g. warning) styles
|
||||
:striped="false"
|
||||
:hoverable="true"
|
||||
:narrowed="true">
|
||||
|
||||
|
@ -81,6 +83,7 @@
|
|||
loading: false,
|
||||
sortField: '${grid.sortkey}',
|
||||
sortOrder: '${grid.sortdir}',
|
||||
rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n},
|
||||
% if grid.pageable:
|
||||
% if static_data:
|
||||
total: ${len(grid_data['data'])},
|
||||
|
@ -96,6 +99,10 @@
|
|||
},
|
||||
methods: {
|
||||
|
||||
getRowClass(row, index) {
|
||||
return this.rowStatusMap[index]
|
||||
},
|
||||
|
||||
loadAsyncData() {
|
||||
|
||||
const params = [
|
||||
|
@ -109,6 +116,7 @@
|
|||
this.loading = true
|
||||
this.$http.get(`${request.current_route_url(_query=None)}?${'$'}{params}`).then(({ data }) => {
|
||||
this.data = data.data
|
||||
this.rowStatusMap = data.row_status_map
|
||||
this.total = data.total_items
|
||||
this.firstItem = data.first_item
|
||||
this.lastItem = data.last_item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue