Yes, this seems to been an unfortunate behavior of the table when the input section is null (or {} or []), the table doesn’t no how to map the columns. The table temporarily stores the all of the columns until the page is refreshed, so that its more efficient if the data returns to the table. What is the flow of data in your app? Maybe there is workaround or suggestion we can provide here.
My scenario is there are 2 tables in a page. Category table and material table.
The data of the material table is filtered by the category selected in the category table.
User can add/edit/delete material from the table.
It works pretty well when there is data.
But when there is no data, it is unable to add new material since the columns disappear.
Well one option here is to replicate this add row form (since we know the schema). This can be done in many ways, but one would be to add a button to the table which opens a modal with the form for the data. Here is a quick example of this:
Go into your table settings and select 'Show Custom Button', you can select a query (which we will make later), and give the button a name
There's also a more hacky approach, in which we take the schema of the data before it's filtered and then use this template object if the filtered data set is in actually empty. Here is an example of this:
In this case we check if the filtered data length is zero, if there's data in there we use filteredData. Otherwise, we use the unfiltered data as a template for the table columns.
Then your insert row query, would again fetch new table data onSuccess. This solution would also increase the computation overhead of your app, so be wary of latency.