A.G.Progm.Enthusiast
A.G.Progm.Enthusiast

Reputation: 1010

How to split a Webix datatable column into multiple columns?

In my webix datatable, I am showing multiple values in the cells for some columns.

To identify which values belong to which header, I have separated the column headers by a '|' (pipe) and similarly the values under them as well.

Now, in place of delimiting the columns by '|' , I need to split the columns into some editable columns with the same name.

Please refer to this snippet : https://webix.com/snippet/8ce1148e

In this above snippet, for example the Scores column will be split into two more editable columns as Rank and Vote. Similarly for Place column into Type and Name.

How the values of the first array elements is shown under each of them will remain as is.

How can this be done ?

Thanks

Upvotes: 1

Views: 626

Answers (1)

Gagan Bansal
Gagan Bansal

Reputation: 323

While creating the column configuration for webix, you can provide array to the header field for the first column along with the colspan like below:

var columns = []; columns[0] =
{"id":"From", "header":[{"text":"Date","colspan":2},{"text":"From"}]};

columns[1] = {"id":"To","header":[null, {"text":"To"}]};

column[0] will create Date and From and column[1] will be creating the To.

Upvotes: 1

Related Questions