Reputation: 1098
While trying to debug a big complex application, I came across that there are plenty of models created in it for different purposes.
Apart from the fact that this is a wrong approach of coding, I am trying to find how can I know the list of all models that are made available to the application.
Any useful methods?
Upvotes: 1
Views: 2061
Reputation: 1044
Just use the UI5 chrome add-on https://chrome.google.com/webstore/detail/ui5-inspector/bebecogbafbighhaildooiibipcnbngo
By the way, it is not the wrong approach to have multiple models.
Upvotes: 1
Reputation: 58
To see all models available to the control, use the following:
Object.assign({}, control.oModels, control.oPropagatedProperties.oModels)
To log all models created during app lifetime, one can monkey-patch the sap.ui.model.Model
constructor and add logging capabilities there.
Upvotes: 2
Reputation: 471
If you want to retrieve all models bound to your view, you could use
this.getView().oModels
to see all existing models for that view.
I don't know of a way to retrieve all models used in your application, but I assume that in order to debug your issue, you at least have access to the View on where your bug is located.
Upvotes: 2