updating a list model object based on another model?
-
Hi all -
My app has a couple list models, one for equipment, and the other for what we refer to as "spaces." Each space has a list of equipment UUIDs (not an actual Equipment object).
When I display my Equipment objects (in a GridView), I need to show whether the equipment is included in any of the Space lists. Currently, I'm using an invokable function in my Space model. The problem with this approach is that my display doesn't automatically change when an Equipment is added to a Space (which I understand).
I'm trying to avoid adding an "assigned" property to my Equipment class, as this information is available elsewhere (in the Space objects), and I'd prefer not to duplicate information. But I can't figure out another way to do this.
Is it possible to create a property for my Space model (not the Space class itself) that would accept an equipment UUID, and return whether this is assigned to any Space in the model?
Any other suggestions are most welcome. Thanks...
-
According my understanding based on your problem statement
- Some methods must have in SpaceModel & return ifExist().. This object emit signal exist(..) or newAdded(..) signal.
- Space model should be connected with Slots in Eqp. Eqp can emit either dataChanged(...) or rowInserted(..) signal.
- GridView will update automatically.
-
@dheerendra yes, you are correct. I needed to make one model aware of the other, in order to connect signals and slots. The rest was straightforward. Thanks.
-
M mzimmers has marked this topic as solved on