Fix block initialization in compose admin all records
This commit is contained in:
@@ -109,7 +109,7 @@ export default {
|
||||
fields = fields.length ? fields : this.module.fields
|
||||
|
||||
// Init block
|
||||
this.block = new compose.PageBlockRecordList({
|
||||
const block = new compose.PageBlockRecordList({
|
||||
blockIndex: 0,
|
||||
options: {
|
||||
moduleID: this.$attrs.moduleID,
|
||||
@@ -126,15 +126,20 @@ export default {
|
||||
showDeletedRecordsOption: true,
|
||||
presort: 'createdAt DESC',
|
||||
enableRecordPageNavigation: true,
|
||||
// Set allrecords configuration
|
||||
allRecords: true,
|
||||
hideConfigureFieldsButton: false,
|
||||
rowViewUrl: 'admin.modules.record.view',
|
||||
rowEditUrl: 'admin.modules.record.edit',
|
||||
rowCreateUrl: 'admin.modules.record.create',
|
||||
},
|
||||
})
|
||||
|
||||
block.options = {
|
||||
...block.options,
|
||||
allRecords: true,
|
||||
rowViewUrl: 'admin.modules.record.view',
|
||||
rowEditUrl: 'admin.modules.record.edit',
|
||||
rowCreateUrl: 'admin.modules.record.create',
|
||||
}
|
||||
|
||||
this.block = block
|
||||
|
||||
// If the page changed we need to clear the record pagination since its not relevant anymore
|
||||
if (this.recordPaginationUsable) {
|
||||
this.setRecordPaginationUsable(false)
|
||||
|
||||
@@ -218,13 +218,11 @@ export default {
|
||||
methods: {
|
||||
createBlocks () {
|
||||
this.fields.forEach(f => {
|
||||
const block = new compose.PageBlockRecord()
|
||||
const options = {
|
||||
moduleID: this.$attrs.moduleID,
|
||||
fields: f,
|
||||
}
|
||||
block.options = options
|
||||
this.blocks.push(block)
|
||||
this.blocks.push(new compose.PageBlockRecord({ options }))
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user