Grouping on multiple columns in a Treetable

I'm having trouble grouping a Treetable by more than 1 column. The first column group works fine but the second doesn't seem to have any affect. I wondering if there are any specific criteria that I'm missing.
Is 'row' required on the groupby object?
Is 'map' required when grouping on multiple columns?
The documentation shows the method "group()" although in a few forums I"ve seen the method "data.group()" Does it matter which one I use?
Is there anything special regarding the 'target' parameter of the group() method? Documentation indicates it's any id of some type but not much other description. Does Target need to increase if I add a 3rd grouping level?

Here is part of a code snippet:

let groupObj = { 
  by: 'ACD',
  row: 'ACD',
  map: {LinkText:["ACD","any"]}
}
$$(this.webixID).group(groupObj);

let groupObj2 = { 
  by: 'ANI',
  row: 'ANI',
  map: {VDN:["ANI","any"]}
}

$$(this.webixID).group(groupObj2, 0);

Comments

  • edited July 1

    Hello Tony,

    The first column group works fine but the second doesn't seem to have any affect. I wondering if there are any specific criteria that I'm missing.

    The data can be grouped (using group method) by one parameter at a time. In order to achieve the multi-level data grouping, it is possible to call group method several times with different parameters which should correspond to the hierarchy of grouping. The deepest level is created first, then a level above, and so on. For more details, please check the related docs chapter with an example.
    As an example of grouping by multiple levels (based on an array of parameters), please check the following solution: https://snippet.webix.com/6f48ygf1

    Is 'row' required on the groupby object?

    No, the "row" property can be used to span all cells in a single row. If you use row parameter in the group method, it creates the overall div on the datatable row which represents the group.

    Is 'map' required when grouping on multiple columns?

    Yes, map is required for grouping according to several criteria.

    The documentation shows the method "group()" although in a few forums I"ve seen the method "data.group()" Does it matter which one I use?

    data.group() applies to DataStore / TreeStore groupings. The grouping methods are not included in the DataStore / TreeStore, this is a separate mixin - https://docs.webix.com/api__refs__groupstore.html. But in general, these methods will be available inside the component’s, so in your case you can just use group().

    Is there anything special regarding the 'target' parameter of the group() method? Documentation indicates it's any id of some type but not much other description. Does Target need to increase if I add a 3rd grouping level?

    In fact, the target id parameter is needed so that the previous grouping is not reset.

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