Grouping on multiple columns in a Treetable

Hi,

I would like to group on multiple columns in a TreeTable. Right now, I am able to do this on a single column using the below scheme code

 view:'treetable',
 scheme:{
               $group:{
                             by   :"Tagname",
                                              map  :{
                                                           Tagname:["Tagname"],
                                                           UnitName:["Unitname"],
                                                           Samples:["Samples","sum"],
                                                           Defects:["Defects","sum"],
                                                           Dpm: ["Dpm","mysum"]
                                                       }
                            }
              }

Now, I would like to Group also on UnitName within Tagname.

Thanks
Ashok

Thank you.

Ashok

Hi,

$group scheme does not allow to apply multiple grouping.

As the workaround you can try to apply group() method twice to datastore of TreeTable (“data” property of datatable instance):

  • first, you need to group rows by their Tagname and UnitName. You can use function as “by” handler of this grouping.
  • then, you should apply “Tagname” grouping.

Please check the example:

http://webix.com/snippet/357f9eb4

Maria, looks like it doesn’t work if data requested from server, I see plain table

In above snippet, you need to call the group API only after data loading

table.load("some.php", function(){
    table.data.group(some_rule)
});

Dear Webix Team,

Can you write an example with table.load?
I use RESTful for loading the data.
Datatype: “xml”,
Url:"/rest/data/loading1"
Thank you in advance!

Regards,
wlad

Hi @wlad,

Here’s the sample:

$$("tableId").load("rest->server/datatable.php", "xml")

rest-> prefix invokes data loading via REST proxy. The second parameter, xml, specifies the data type.

Please check also the corresponding part of the documentation and the API.

Hello Listopad,

Thank you for the reply!
Accuse me, I may have wrongly described my problem.
I get the data from Basex rest-server, Basex converts the data from MSSQL to XML.
$$ ( “treetable”). Load ( “/ rest / data / loading1”, “xml”); works perfectly.
If I try to implement this example: http://webix.com/snippet/357f9eb4, then does not work. I would like to make treetable 2 and 3 levels.

Regards
wlad

Data grouping is a client-side feature, so you need to wait for the moment when the entire dataset will be loaded:

http://webix.com/snippet/9b02fa30

Hello Listopad,

Thank you for the help!
I have a short question.
What am I doing wrong. Why instead of “Item” I get “undefined”.
My example: http://webix.com/snippet/201ab90b

Regards
wlad

Hello,

You’re welcome! The last level contains the actual data items, so the template should return the corresponding data attribute:

http://webix.com/snippet/e3a2bf60

Hello Listopad,

Thank you very much!
Everything works perfectly!
Good evening!

Regards
wlad