Fix block initialization in compose admin all records

This commit is contained in:
Jože Fortun
2023-02-28 11:33:05 +01:00
parent 00110dc4f5
commit 455afb94b0
2 changed files with 12 additions and 9 deletions
@@ -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 }))
})
},