I decided to prototype this feature to see how tough it would be, and got it working pretty quickly. However, I discovered an issue with the concept - generally, when you want your table columns sized to fit, you also want to include the preferred width of the header in your calculations. TableViews know nothing about their headers - it is the other way around (TableViewHeaders know about the TableViews to which they are assigned - it is where they get the column sizes). So, the TableView can't possibly factor the width of the header into the calculation.

As a result, I think code such as this probably belongs at the app level, not in the table view itself. You could pretty easily write a method that will, using the column's cell renderer, determine the max. cell width and explicitly set the column width to that value. You'd just need to re-run this method every time your table data changes (which, presumably, you would be aware of).

G

Reply via email to