How to add row in a empty table

Tags: #<Tag:0x00007efc647c6098> #<Tag:0x00007efc647c5ee0>

I would like to know how to add a new row to the table if it is empty or has no records?

Hi @jonatas.locateli

There are two options, first would be to use contextMenu, click on 0 (top-left) header and add a new row. The second one would be to use alter()method and add rows programmatically. Both options are present in this example: https://jsfiddle.net/handsoncode/0tpwdz8e/ I commented out the line with the alter method.

Hi, @adrian.szymanski

Is it only possible to manually add a row to an empty table if you use “colHeaders: true” and “rowHeaders: true”?
Another point, using your example, the inserted lines are becoming misaligned with the column of numbers, like the image below and the demo: https://jsfiddle.net/t3ngrf6u/

@jonatas.locateli

Without those options configured and with no data you will not be able to see the table at all.

This issue was caused by declaring wrong width value, if you don’t need the table to be specific size it’s best to not declare width and height options in the settings. Here’s fixed example: https://jsfiddle.net/handsoncode/9La6kows/

Hi, @adrian.szymanski
Even following the model settings, the number lines remained misaligned in my project. But I decided to change and solve it in another way. Anyway, thanks for the feedback.

@jonatas.locateli

Thank you for the update. I’ll close this topic in that case.