Table grouping with DataCollection

Hi everyone,

I would like to know how I can achieve setting up grouping on a table linked to a DataCollection.

If I pass directly the data to the table, it works:
https://webix.com/snippet/cdbee345

Otherwise if I pass the data to the DataCollection, or load it via an Ajax request, it doesn’t work:
https://webix.com/snippet/69231bca

Anyone has a idea on what I should do to have a treetable grouped by using a DataCollection (or TreeCollection maybe) ?

Thanks a lot

up

Hello!
So here are several solutions:
Without DataCollection the solution will look like: https://webix.com/snippet/83b7599d

As collection is not a plain data array, parse(collection) uses different logic to transfer the data from the collection to the datatable. In such case, $group will not be called. You can call property group after parse() which is groups data by the specified data property.
Please, check the snippet: https://webix.com/snippet/bf066a9e

If you work via an Ajax request, so it’s better to use instead of parse - sync with callback.
Here is an example: https://webix.com/snippet/ce5e1219

Thank you for your answer Nastja, the third one is exactly what I was looking for!