I'm using tabulator.js to display and manipulate data in form of a table. How can I edit multiple lines of data at once with tabulator? For example, if I have a table of items, with the columns name and price, and I want to change the price of multiple entries to the same value.
The goal is to mark the fields I want to edit and type or select the new value, which should be changed for all the selected entries. I didn't find anything about multiline editing / bulk editing in the editing part of the documentation. Can this be achieved in any way?
There is no built I way to achieve this.
You could get all the table rows using the getRows function, then itterate over each row calling the update function on the row component to update the rows data.
var rows = table.getRows();
rows.forEach((row)=>{
row.update("name":"steve"); //update the name of each row to steve;
});
This has a bit of a downside in that it will trigger an update of the table with each row update.
To get round this and make things a bit more efficient you could call the blockRedraw before the updates, then call the restoreRedraw function after, that way the table will only be redrawn once.
var rows = table.getRows();
table.blockRedraw();
rows.forEach((row)=>{
row.update("name":"steve"); //update the name of each row to steve;
});
table.restoreRedraw();