How to render 45 degree diagonal headings on tables
Added by James Adams almost 10 years ago
Our soon to launch Wt application features tables which are currently generated using WTableView with accompanying WAbstractItemModel.
Some of our tables are too wide and horizontally overflow a typical monitor. We have already limited the tables overall width and implemented a horizontal scroll bar, however many of the columns only contain Boolean data and it is the heading for those columns which is creating the problem. As such, what we would really like is a means to rotate the the table heading text to 45 degrees, something like the nice table example lower down the page here:
http://brettterpstra.com/ios-text-editors/
This can obviously be done using CSS transforms although cross browser support (especially with IE) is a little limited using pure CSS. I'm aware of some js methods to do this, one of the more effective ones being Sandpaper, as seen at http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/
(although Sandpaper is a little on the heavy side and uses other libraries).
Is there a simple solution using Wt's current functionality to achieve 45 degree rotated headings in a WTableView?
If not what is the most elegant solution to achieve 45 degree rotated table headings / supplement with external js to ensure cross browser support?
Vertical table headings may be acceptable if this is simpler although we would really like them to be 45 degrees.
45-deg.png (8.3 KB) 45-deg.png |
Replies (1)
RE: How to render 45 degree diagonal headings on tables - Added by Koen Deforche almost 10 years ago
Hey,
There is no easy (cross-browser) solution. One trick is to put the header outside the table and tie the scrolling of the table to a custom header widget. You can also react to column resizes.
This trick has been used in several projects already to implement for example more complicated headers of multiple rows.
Koen