mum4k / termdash

Terminal based dashboard.
Apache License 2.0
2.72k stars 136 forks source link

How to add sub-container with id #358

Open pavel-blagodov opened 10 months ago

pavel-blagodov commented 10 months ago

Hey,

Could you please clarify how to add sub-container with id, so that it can be updated without updating siblings containers. I'm using grid layout

Thank you

mum4k commented 9 months ago

Thank you for reaching out @pavel-blagodov. To update a sub-container, you would first give that sub-container a known ID using the contained.ID("some_id") option. You can then update any options on that container including sub-splits by calling the container.Update() method as documented in Dynamic Layout and referring back to the same ID.

Please refer to https://github.com/mum4k/termdash/pull/359 which demonstrates this on the termdashdemo. When running the demo, you can press Ctrl-U to update a sub-container (changes widget from green sparkline to a red sparkline). Any other updates are possible as well.