autofit column widths on FeatureTable

223
0
08-17-2022 01:25 PM
WCSOLET
New Contributor

I am using a FeatureTable very much like this one...

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=highlight-features-by-ge...

Just like in this example, the content of my first column is often long and consequently is cut short, while my second column contains a state abbreviation and can be much shorter. Unfortunately, the FeatureTable seems to be hard-coded to make every column the same width.

I am aware of the css trick to at least allow the cell to grow vertically when there is overflow...  vaadin-grid-cell-content {white-space: normal !important;}

And I tried to loop through all the "vaadin" cell elements with javascript, changing the style width=auto, also tried adding an "auto-width" attribute, also tried beating my head against the wall. Nothing seems to work.

Is there some undocumented way to tell the table to try to autofit column width? This seems like it should be a property of the TableTemplate and/or the ColumnTemplate, but no luck. If varying column widths is not an option in the FeatureTable, any ideas how I might hack the example above to make the second column narrower and the first column wider?

0 Kudos
0 Replies