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.63k stars 735 forks source link

Update sidebar.topHTML after initialization #2486

Closed jankrnavek closed 5 months ago

jankrnavek commented 6 months ago

It seems there is a regression in the sidebar.
I cannot update sidebar.topHTML definition. The code below already worked, and now it doesn't. E.g. updating nodes still works...

(w2ui 2.0.x (nightly) (12/30/2023, 11:12:53 AM)

w2ui.sidebarRight['nodes'] = getSnapshotNodeDefinitions.value   // this works
w2ui.sidebarRight['topHTML'] = 'aaa'  // this doesn't work, the old content is still shown 
w2ui.sidebarRight.refresh()
vitmalina commented 5 months ago

Are you sure it used to work? I checked the code and I see that it will update top and bottom html when render() method is called, but not referesh. Looking at the code, I see comments that say that topHTML should not be refreshed in refresh() as it might have input control with search for example, and then it would clear it. Refresh method updates nodes, I think it would be better to update topHTML and bottomHTML manually is needed after initial render

vitmalina commented 5 months ago

I propose we keep it like it is

jankrnavek commented 5 months ago

I thing it woud be very usefull feature. E.g. you have sidebar with many items which number differs in time and in the topHTML you have actuall number of items.

vitmalina commented 5 months ago

@jankrnavek , you can easily implement this feature directly updating html inside topHTML, I do think it should be done with grid.refresh(). Thank you.