Datatable insert several new columns and values

Hello,
is it possible to insert several columns at the same time into an existing datable?
See here:
https://snippet.webix.com/xbrx4a43

And is it possible to load into these new columns new data from another datasource? I need to compare values in that table and the new columns need to be editable (therefore no Pivot?)...

Thanks!
Martin

Comments

  • edited August 10

    Hi Martin,

    There isn't any specific method for inserting multiple columns, but you can work with datatable.config.columns as with a standard JS array:

    columns.splice(2, 0, config1, config2, ..);
    

    To fill the new columns with data, you need to add the related fields into each data item using the datatable.data.each loop:

    grid.data.each(function(obj){
         obj[field] = value;
    });
    grid.refresh();
    

    Please, check the related snippet: https://snippet.webix.com/7t6xf57n

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion