Let caller define row sorting for model-crud
also display a "title" for rows if set
This commit is contained in:
parent
36ba991bdc
commit
e7a0ddb782
|
@ -84,6 +84,7 @@
|
||||||
<slot name="quick-entry"></slot>
|
<slot name="quick-entry"></slot>
|
||||||
|
|
||||||
<div v-if="hasRows && mode == 'viewing'">
|
<div v-if="hasRows && mode == 'viewing'">
|
||||||
|
<h2 v-if="rowsTitle">{{ rowsTitle }}</h2>
|
||||||
<slot name="row-filters"></slot>
|
<slot name="row-filters"></slot>
|
||||||
<b-menu>
|
<b-menu>
|
||||||
<b-menu-list>
|
<b-menu-list>
|
||||||
|
@ -132,6 +133,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
rowsTitle: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
rowsPaginated: {
|
rowsPaginated: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
|
@ -153,6 +158,14 @@ export default {
|
||||||
return JSON.stringify([{field: 'batch_uuid', op: 'eq', value: uuid}])
|
return JSON.stringify([{field: 'batch_uuid', op: 'eq', value: uuid}])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
rowOrderBy: {
|
||||||
|
type: String,
|
||||||
|
default: 'modified',
|
||||||
|
},
|
||||||
|
rowOrderAscending: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
allowEdit: {
|
allowEdit: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
|
@ -434,8 +447,8 @@ export default {
|
||||||
fetchRows(uuid) {
|
fetchRows(uuid) {
|
||||||
let params = {
|
let params = {
|
||||||
filters: this.rowFilters(uuid),
|
filters: this.rowFilters(uuid),
|
||||||
orderBy: 'modified',
|
orderBy: this.rowOrderBy,
|
||||||
ascending: 0,
|
ascending: this.rowOrderAscending ? 1 : 0,
|
||||||
}
|
}
|
||||||
if (this.rowsPaginated) {
|
if (this.rowsPaginated) {
|
||||||
params.per_page = this.rowsPerPage
|
params.per_page = this.rowsPerPage
|
||||||
|
|
Loading…
Reference in a new issue