Let caller specify how to generate row item routes, for model-crud

This commit is contained in:
Lance Edgar 2019-11-15 10:30:51 -06:00
parent d8e215a1dd
commit 55efba432a

View file

@ -64,7 +64,7 @@
<b-menu-item v-for="row in rowData.data"
:key="row.uuid"
tag="router-link"
:to="getRowPathPrefix() + '/' + row.uuid">
:to="getRowRoute(row)">
<template slot="label" slot-scope="props">
<span v-html="renderRowLabel(row)"></span>
</template>
@ -116,6 +116,7 @@ export default {
type: Number,
default: 20,
},
rowRouteGetter: Function,
apiRowsUrl: String,
isRow: {
type: Boolean,
@ -400,6 +401,13 @@ export default {
})
},
getRowRoute(row) {
if (this.rowRouteGetter) {
return this.rowRouteGetter(row)
}
return this.getRowPathPrefix() + '/' + row.uuid
},
changeRowPagination(value) {
this.fetchRows(this.record.uuid)
},