PDA

View Full Version : How to know which views are using my custom ModelView?



qlands
5th July 2011, 13:15
Hi,

Giving that a model can be shared between several views.. How can I know which views are using my model from inside the my model class?

Thanks,
Carlos.

SixDegrees
5th July 2011, 13:27
In general, you can't; this would violate the model/view design. Models are sources of data and nothing more; they provide data upon request, without regard for the view asking for it.

Most often, if you find yourself wanting this sort of information, there's something wrong with your design.

mcosta
5th July 2011, 13:36
seems that public ItemModel API doesn't allow to know connected views.

I think it is correct because the Models provide data and don't need to know where and how these data are displayed.

If you need you can inherits your model class and reimplement setModel in order to save views list