Pivot - custom ids

Hi,

I have a next question :slight_smile: My source data contains record’s id that is not shown in pivot but presents in columns list. I would like to get it when onSelect event fires like

datatable.attachEvent("onAfterSelect", function(id) {
    var record = this.getItem(id);
    console.log(record);
});

But record contains only visible columns.

Is there any way to attach custom ids to rows during tree loading (processing)?

Hi,

Pivot record is the result of aggregation of several records from the initial datasource. It contains the uniting property (for instance, “name”) and sum/average/etc. of all the records that feature the same “name” - in other words, only fields that take part in aggregation.

The initial data is still accessible through pivot datastore as $$(“pivot”).data.pull. And it can be iterated so that you can get all items that were summed, etc. for this or that pivot record. And then have access to any of their properties.

$$("pivot").$$("data").attachEvent("onAfterSelect", function(id) {
      var record = this.getItem(id);
      var groupped = [];
      $$("pivot").data.each(function(obj){
           if(obj.name===record.name)
                 groupped.push(obj); 
        });
        console.log(groupped);
});

Hi, Helga,

It works for me, thank you so much.