on 03-06-2017 10:52 AM
Hi All,
I am trying to pass a model from one controller to another.
Static data is getting passed using the event bus technique.
But when it comes to passing a model, then I am not able to get back any data.
Please give me the right syntax to pass a model in this context.
I tried almost everything.
This is the first master controller.capture1.png
This is the second detail controller capture2.png
usually we don't that, model can be stored at component level, which can be accessed in any view directly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Akanksha,
set the model to core in view1 and you can acess this in view2.
sap.ui.getCore().setModel()
Alternatively, set it at component level.
Regards,
Gowrinath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Gowrinath.
Actually, I am a beginner in this field of SAPUI5. I am trying to implement a master detail application.
I wanted to select a field from the master view and display its details in the detail view.
I am able to select the data and flow only static data from one master to detail controller.
As a result of which I am updating the view accordingly.
Thanks for the reply 🙂
Regards,
Aakanksha Gupta
Hi Aakanksha,
Don't know if its exactly what you are looking for, but this is how i usually pass data from one controller to the other, maybe you can pass an odata object too.
view.byId("idAppControl").to("FullScreen", "fade", {
"pageToGetBack" : "DashBoard",
"itemToShow" : table,
"title" : _title
});
//and on the fullscreen controller i have this code
onInit : function(evt) {
this.getView().addEventDelegate({
onBeforeShow : function(evts) {
//inside evts.data will be all the parameters you passed
_that.pageToReturn = evts.data.pageToGetBack;
page.setTitle(evts.data.title);
}
});
Best
Leandro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Leandro.
I used this technique earlier, but there was a route based issue everytime.
So I switched on the eventBus technique.
Here, using this static data was flowing well, but the client based json file was not flowing based on the primary key.
Thanks for the help. 🙂
Regards,
Aakanksha Gupta
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.