How to adjust pivot column width?

Hi,
Is there any way to adjust column width of pivot tables?

Hello!
The configuration of columns (including width) can be changed through the onBeforeRender:

 on:{
    onBeforeRender: function(config){        
      var columns = config.header;
      for(var i=0; i< columns.length;i++){                             
          columns[i].width = 150    // equal width for all columns
      }
    }
  }

ID of each column is based on its actual data: columns/values names and type of the current data operation. For example:

id: "2005_'_max_'_oil" //column_'_operation_'_value

So if you want to get the config of the particular column, you need to use the substring comparison or a regexp.

I see, but it doesnt do what I specifically want. I just wanted to have an automatically adjustable column size like in datatable.

Hello @takero ,

Using the above approach, you can set the same sizing logic as in datatable (instead of plain width).

  • minWidth and fillspace with needed proportions,
  • minWidth and adjust with adjustment to data/header/both of them.

The minimum limit for width is highly recommended in order to show the columns properly despite their number.

Also, I would suggest preserving the 1st column (“name”) in its original state, as this column is intended to be always visible (frozen).

onBeforeRender: function(config){        
  var columns = config.header;
  for(var i=1; i< columns.length;i++){     // ignore the "name" column
      columns[i].fillspace = true;
      columns[i].minWidth = 120;
  }
}