Search code examples
jsondatatablewebix

During Webix datatable sub-column edit how to modify the nested JSON data accordingly?


In my Webix datatable, I have multiple columns under one column header by colspan. I populate the table by a JSON data and that JSON data is having an Array structure to populate those sub-columns.

I observe that when I edit a cell under those columns, it is adding one extra field to the data set and not updating the exact nested object.

Let's say for a specific row, the data set looks like below before editing :

obj = {"No":"1","Name":"Justine","place":[{"address":"address1","name":"name1"}],"id":1512587573601}

Now if I edit the adress field to 'address_new', then it is getting added as a separate key (as place_address) to the data set as below :

obj = {"No":"1","Name":"Justine","place":[{"address":"address1","name":"name1"}],"id":1512587573601,"place_address":"address_new"}

Here is the snippet: https://webix.com/snippet/7882897c

How can this be solved?

Thanks.


Solution

  • I think you are doing lot of work, you can do the same by simple steps: https://webix.com/snippet/c60a1b45