How to add row and column

Tags: #<Tag:0x00007efc72f68810>

So i want to add a new row and column with the data inside it, example

the dimension i have is 52x52 and then i want to add a new row and column so the new dimension will be 53 x 53 with the same data as before, how to do it?

Hi @khoironidev

Are those columns and rows should be at the start, end, or in the middle (elsewhere) of the table?

The alter method is the one that is able to add/remove columns and rows on any given index. And to fill those columns with data you can use populateFromArray() method or setDataAtCell() method. I also recommend using batch() method to gather all those changes within one function - that would benefit the overall performance of that operation.

those columns and rows should be at the end of the table

In that case you alter method would look like this

hot.alter(‘insert_row’, hot.countRows(), 1)
hot.alter(‘insert_col’, hot.countCols(), 1)

where hot is your reference to Handsontable instance and 1 is a single row/column that is added.