diff --git a/src/frontend/components/data-table/lib/component.js b/src/frontend/components/data-table/lib/component.js index d000da18f..00d1557df 100644 --- a/src/frontend/components/data-table/lib/component.js +++ b/src/frontend/components/data-table/lib/component.js @@ -615,7 +615,7 @@ class DataTableComponent extends Component { this.json = json || undefined - if (this.initializingTable) { + if (this.initializingTable || conf.reinitialize) { dataTable.columns().every(function(index) { const column = this const $header = $(column.header()) @@ -721,10 +721,10 @@ class DataTableComponent extends Component { // Move data table into new modal newModal.append(table); + document.body.appendChild(newModal); if(currentTable && !($.fn.dataTable.isDataTable(currentTable))) { - currentTable.DataTable(this.getConf({responsive: false})); + currentTable.DataTable(this.getConf({responsive: false, reinitialize: true})); } - document.body.appendChild(newModal); $(document).on("keyup", (ev)=>{ if(ev.key === "Escape") { @@ -741,7 +741,7 @@ class DataTableComponent extends Component { mainContent.appendChild(table); if(currentTable && !($.fn.dataTable.isDataTable(currentTable))) { - currentTable.DataTable(this.getConf()); + currentTable.DataTable(this.getConf({reinitialize: true})); } // Remove the modal document.querySelector('#table-modal').remove(); diff --git a/src/frontend/js/lib/util/mapper/formdataMapper.test.ts b/src/frontend/js/lib/util/mapper/formdataMapper.test.ts index e2a06be2e..d7560d53e 100644 --- a/src/frontend/js/lib/util/mapper/formdataMapper.test.ts +++ b/src/frontend/js/lib/util/mapper/formdataMapper.test.ts @@ -14,23 +14,6 @@ describe("Basic formdata mapper tests", () => { expect(formdataMapper(data)).toEqual(formData); }); - it("should throw an error for nested objects deeper than one layer", () => { - const data = { - name: "John Doe", - age: 30, - email: "john@example.com", - address: { - street: "1234 Elm St", - city: "Springfield", - state: "IL", - zip: { - code: 62701 - } - } - }; - expect(() => formdataMapper(data)).toThrow(new Error("Nested objects deeper than one layer are not supported")); - }); - it('should return the same FormData object if it is passed in', () => { const formData = new FormData(); formData.append("name", "John Doe");