vitmalina / w2ui

UI widgets for modern apps. Data table, forms, toolbars, sidebar, tabs, tooltips, popups. All under 120kb (gzipped).
http://w2ui.com
MIT License
2.64k stars 730 forks source link

Add max/min limits for the column auto size feature #2434

Open KirillBorunov opened 1 year ago

KirillBorunov commented 1 year ago

Problem:

I'm using the columnAutoSize() function after adding the columns and records to the grid. https://github.com/vitmalina/w2ui/blob/2b1c43d3b57cc30db37aca4af084281e928a1a88/src/w2grid.js#L3853

This causes problems with very large values where the column can get very wide and unusable. image

Currently I can set the column "max" and it limits the auto size, but it also limits the user to size up the column.

Proposed solution:

Can we add max and min limits for the auto size feature?

Is NOT the same as the existing column "min" and "max": https://github.com/vitmalina/w2ui/blob/2b1c43d3b57cc30db37aca4af084281e928a1a88/src/w2grid.js#L212-L213 These apply when user resizes the columns manually.

The new ones will limit only the auto resize feature (maybe we can call them "autoSizeMin" and "autoSizeMax"?) and will not limit the user to manually change the size over/under the auto size limits. The normal size limits still apply and auto size should respect them too.