Instant data-free copying

It seems like a simple task, but so far I have not found a simple solution. My data sometimes comes in as an empty array, so the user can start processing an empty table (with the exception of the headers). There is minSpareRows:1 in the table, so I was hoping the table would appear with this spare row and nothing else, but instead it would be completely empty.

Any ideas on how to create an instance of a table with only a spare row and column headers?

Things I tried include manually inserting a row if the data array is empty, however this results in there being an empty row plus a spare row.

+6
source share
1 answer

You can use minRows and minCols to create an empty copy instance. In addition, the data arguments assume an array of arrays, so in your case, when you get an empty array, just wrap it in another:

 data : Array of Arrays (default [ [] ]) 

This is where JSFiddle works.

+8
source

Source: https://habr.com/ru/post/981292/


All Articles