What happen is some of the column name is relatively long, and this is making the grid very untidy as some column is wider and some column is narrower even presenting similar numbers.
I have tried to change the “colWidths” parameter to something ridiculously small, but it appears UX is still making the column width to be the same length as the column header text.
What I want to achieve is something similar to Excel, we can increase the height of the column header, make it text wrapping, and then I can change the width of the column, but how do I do it?
For wrapping the column headers, you can create a custom CSS Style and apply the format to a specific/all columns on …\apq-c3-custom\css\custom-style.css
There are a few threads on that in the forum already:
For the column widths, after you applied the word wrapping, you can change dragging the cursor on the column then use the “save to options” on edit mode, and it will save the advanced settings, the code you can modify later on, might need a bit of testing on the size depending on the col header size.
In the past I’ve also split out the classes to allow for header alignment, e.g. so rowset column headers can be left aligned and numeric columns right aligned at a client. Each option had a separate class which could be assigned in the advanced settings:
However I came across additional problems with wrapping the column headers:
Row-header height issue
The header height becomes larger automatically for longer header names as they’re wrapped (e.g. 44px) but the row-header doesn’t grow with it and stays at the same height as the default (presumably because AngularJS is defining the element.style in-line in the HTML), so it causes a mis-alignment between the rows and the data in the rows:
I had to get around that by forcing the line height of the rowheader to be 46px and the column headers to be 44px (to account for the ibcs-class bottom borders).
Nested column dimensions
There’s also a knock-on issue caused when you have nested dimensions on the columns and you might need to only wrap the bottom column header, so you need to isolate it using something like tr:last-child or specifying the level e.g. th.columnHeaderLevel0, th.columnHeaderLevel1 in the CSS.
Would be great if for each column header you could just select wrap/no-wrap and left/centre/right alignment in the settings GUI and it did it all for you.
I prefer creating a dedicated predefined grid style for such purposes. This way you have more control over the style requirements for specific use cases and eliminate issues like misalignment between the first column and the rest of the columns.
Create the necessary style in css for the dedicated table style class.