outl1ne / nova-resizable

A simple tool to allow resizing of nova resource table.
MIT License
17 stars 5 forks source link

Feature Request: Remember resize #3

Closed Peterragheb closed 1 year ago

Peterragheb commented 3 years ago

Can you please make it that the column remembers its last resize width?

keizah7 commented 3 years ago

It would be great

eimantaaas commented 3 years ago

+1

sfinktah commented 3 years ago

@Peterragheb I'm not sure sure that would necessarily desirable, e.g. if the table is consequently viewed at a different viewport size.

it would also introduce technical issues, as the individual columns are automatically resized so the total of column widths do not fall below the table width.

i would suggest trying something simpler first, like implementing minWidth and maxWidth for individual columns. then seeing how the resultant table behaves. it might be necessary to add an empty buffer column on the far right.

even this would be non-trivial as you would have to find a way to set and communicate those settings to the resize component which operates purely on the table itself. kinda tricky to add ->minWidth and ->maxWidth properties to every nova component and have them actually do something.

sfinktah commented 3 years ago

Update: I implemented minColumnWidth and maxColumnWidth, it wasn't actually that hard. I smuggled the info in via meta and wrote it to data-min-column-width attributes in the headers... from there, a few quick hacks of the resizing javascript had it reading in the values.

Since I also took the opportunity to write the name of the resource into the table tag, it would be a simple task to use LocalStorage to write unique keys resourcefieldwidth and thus remember the column size. It could probably even be done without any of the modifications I made.

sfinktah commented 3 years ago

Well, here it is. It has some extra code from my min/max routines, but yeah... it does work.

https://github.com/optimistdigital/nova-resizable/pull/6/commits/e7996b6a05b302d04a5b698840fb0c98a1c8d2f8

keizah7 commented 2 years ago

We will check it out. Thank you