Merge pull request #11875 from Budibase/fix/table-block-delete-button-default
Fix for ensure Table Block Delete button displays when creating an auto generated screen.
This commit is contained in:
commit
097ca7a65c
|
@ -33,6 +33,8 @@ const generateTableBlock = datasource => {
|
||||||
showTitleButton: true,
|
showTitleButton: true,
|
||||||
titleButtonText: "Create row",
|
titleButtonText: "Create row",
|
||||||
titleButtonClickBehaviour: "new",
|
titleButtonClickBehaviour: "new",
|
||||||
|
sidePanelSaveLabel: "Save",
|
||||||
|
sidePanelDeleteLabel: "Delete",
|
||||||
})
|
})
|
||||||
.instanceName(`${datasource.label} - Table block`)
|
.instanceName(`${datasource.label} - Table block`)
|
||||||
return tableBlock
|
return tableBlock
|
||||||
|
|
|
@ -45,8 +45,21 @@
|
||||||
let enrichedSearchColumns
|
let enrichedSearchColumns
|
||||||
let schemaLoaded = false
|
let schemaLoaded = false
|
||||||
|
|
||||||
// Accommodate old config to ensure delete button does not reappear
|
$: deleteLabel = setDeleteLabel(sidePanelDeleteLabel, sidePanelShowDelete)
|
||||||
$: deleteLabel = sidePanelShowDelete === false ? "" : sidePanelDeleteLabel
|
|
||||||
|
const setDeleteLabel = sidePanelDeleteLabel => {
|
||||||
|
// Accommodate old config to ensure delete button does not reappear
|
||||||
|
let labelText = sidePanelShowDelete === false ? "" : sidePanelDeleteLabel
|
||||||
|
|
||||||
|
// Empty text is considered hidden.
|
||||||
|
if (labelText?.trim() === "") {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to "Delete" if the value is unset
|
||||||
|
return labelText || "Delete"
|
||||||
|
}
|
||||||
|
|
||||||
$: isDSPlus = dataSource?.type === "table" || dataSource?.type === "viewV2"
|
$: isDSPlus = dataSource?.type === "table" || dataSource?.type === "viewV2"
|
||||||
$: fetchSchema(dataSource)
|
$: fetchSchema(dataSource)
|
||||||
$: enrichSearchColumns(searchColumns, schema).then(
|
$: enrichSearchColumns(searchColumns, schema).then(
|
||||||
|
@ -249,7 +262,7 @@
|
||||||
props={{
|
props={{
|
||||||
dataSource,
|
dataSource,
|
||||||
saveButtonLabel: sidePanelSaveLabel || "Save", //always show
|
saveButtonLabel: sidePanelSaveLabel || "Save", //always show
|
||||||
deleteButtonLabel: deleteLabel, //respect config
|
deleteButtonLabel: deleteLabel,
|
||||||
actionType: "Update",
|
actionType: "Update",
|
||||||
rowId: `{{ ${safe("state")}.${safe(stateKey)} }}`,
|
rowId: `{{ ${safe("state")}.${safe(stateKey)} }}`,
|
||||||
fields: sidePanelFields || normalFields,
|
fields: sidePanelFields || normalFields,
|
||||||
|
|
Loading…
Reference in New Issue