diff --git a/changes/change_topButton b/changes/change_topButton new file mode 100644 index 00000000..7663b62f --- /dev/null +++ b/changes/change_topButton @@ -0,0 +1 @@ +Action buttons now appear at both top and bottom of the table \ No newline at end of file diff --git a/ts/component/table-builder.ts b/ts/component/table-builder.ts index 24776c17..7fb8fb03 100644 --- a/ts/component/table-builder.ts +++ b/ts/component/table-builder.ts @@ -219,14 +219,23 @@ export class TableBuilder { if (!data && !this.definition.queryUrl) { throw new Error("Query url is required for loading table via AJAX"); } + const topControlsContainer = document.createElement("div"); + topControlsContainer.className = "flex justify-end mt-4 items-top space-x-2"; + if (!this.definition.disablePageControls) { - const topControlsContainer = document.createElement("div"); - topControlsContainer.className = "flex mt-4 items-top space-x-2"; this.addSortControls(topControlsContainer); this.addFilterControls(topControlsContainer); + } + if (this.definition.bulkActions || this.definition.staticActions) { + this.addActionButtons(topControlsContainer); + } + if (!this.definition.disablePageControls) { this.addPagingControls(topControlsContainer); + } + if (topControlsContainer.children.length > 0) { this.container.appendChild(topControlsContainer); } + const tableContainer = document.createElement("div"); tableContainer.className = "mt-4 overflow-auto"; this.table = document.createElement("table");