Dynamic updating a Container

I’m trying to do something similar to a table. I have a custom widget that I want to be my row (QueueStatusRow). I want to have another widget QueueRow that will add/remove QueueStatusRow from itself when data is updated.

Right now I’m having trouble getting it to dynamically add and remove the views. Both QueueStatusRow and QueueStatus inherit from Static. I’ve tried using update, refresh, and a bunch of other ways with no luck. How would you suggest being able to create/destroy widgets from inside another widget?

parent.mount will add a widget. widget.remove will remove it. Does that help?

Thanks, that’s what I was looking for. Missed it in the docs/tutorial.

Yeah this is the way but also, an interesting feature of mount in recent versions of textualize is that you can give a before= or after= argument. This can be either an index or a widget. If it’s a widget it’ll look it up in the chilren to find the index. In either case this lets you place widgets anywhere in the list of children you want.

Also you might like to look at the code for DataTable - I learned a lot about making more complex components from that. You might even be able to make your widget as a subclass of DataTable or in composition with it.