How to add new row?

I have a context menu “Add row” on spreadsheet. Once user Click on this menu 1 row should get added to spreadsheet with dummy data and should be saved to database as well. Do you have any workaround the same?

Hello @priyab ,

Description - I have a context menu “Add row” on spreadsheet. Once user Click on this menu 1 row should get added to spreadsheet with dummy data and should be saved to database as well.

A single row can be easily inserted by calling the insertRow() method. You can specify the exact place where the row should be inserted as well, which allows you to make use of the context menu location. The context menu itself can be modified via the onContextMenuConfig event handler, allowing you to replace the default context menu entirely with a custom one. That said, you will simply replace the visual menu representation, without assigning any functionality to the new context menu. To make your new menu functional, you should assign custom functions to every command called within the new menu via the onCommand event handler.

To actually save the result of the performed operation, you can either:

1\. Use the save function and enable state saving by setting the all property of save:

 save: {
    all: url
  }

This will ensure that the save() function will trigger every time the state of a spreadsheet is changed (i.e. a row is inserted).

2\. Alternatively, it is possible to serialize all sheets using the following settings:

const fullData = spreadsheet.serialize({sheets: true});

it will return an object with a number of parameters that will keep all of the changed states. Using the onChange event handler, it is possible to manually send a server request with the following data and ensure the completeness of the initial dataset.

Both of these methods are futher described in our documentation.

Considering the required functionality, the end result would look something like this, please take a look: https://snippet.webix.com/i4vbq7z6.

@Dzmitry -
Your solution (https://snippet.webix.com/i4vbq7z6) works and it adds a new row .Thank you for this.
But new row is not showing dummy data, A blank row is getting inserted to spreadsheet.
I have tried using setCellValue and setRangeValue both but didn’t work.

Note- I have a long spreadsheet having column range upto FZ.