fin-hypergrid / core

A canvas-based super high performant grid renderer API
MIT License
897 stars 144 forks source link

schemas - are there max and min cell width options? #759

Closed RandomGHUser closed 6 years ago

RandomGHUser commented 6 years ago

I have browsed the custom schema areas and property pages online, but am not seeing any options for min and max width for cell width. Example: if I want a cell to have a max width of 20px, I'd imagine the syntax as something like

schema: [{name: "stats", header: "Status", max-width:"20px", min-width:"5px"}, ... ]

If this does not currently exist in some form, I can create my own function easily enough by using some math, iterating the columns and setting the column widths, I'm just checking before doing so.

joneit commented 6 years ago

There is a column property minimumColumnWidth:

Minimum column width. Adjust this value for different fonts/sizes or exotic cell renderers. Must be defined. The default (5) is enough room for an ellipsis with default font size.

Note that column schema properties automatically set column properties of the same name so, yes, you can use minimumColumnWidth:5 in column schema. This would be similar to your example min-width:"5px" except it's an integer (no "px" unit).

I have created a new separate issue to request implementation of a new maximumColumnWidth property in version 3.1 (see #761).