How to format group labels in Pivot

Hi,
I would like to format group labels for the pivot: first columns and top headers.

I tried using the $$("data").config.columns[].template function, but I am unable to guess the data field name/type and to get the .template for the other top headers.

https://snippet.webix.com/vnfddasb

I need to know the data field of each label to apply the correct formatting (e.g. number or data) and keep the level of grouping.

Can anybody help?

Thank you

Comments

  • Anybody with this issue?

  • edited October 21

    Hello @mabiuso ,
    Pivot has onBeforeRender event. This handler receives the pivot configuration object that will be used to initialize the component. Since this handler is called before the pivot is initialized, any modifications done to the initial configuration object will be reflected upon its initialization. In this way, you can change the template in all or in the particular columns so by accessing the header property within the configuration object:

    on:{
         onBeforeRender: function(config){
               var columns = config.header;
               for(var i=1; i < columns.length; i++){
                     // columns[i]
               }
         }
    }
    

    Please, check the following snippet:
    https://snippet.webix.com/44g9mwl0
    For more details, please check the related documentation chapter:
    https://docs.webix.com/pivot__customization.html

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!