on 10-09-2015 12:58 PM
hello experts,
I am facing an issue, when I am trying to use a particular variable on a detail page(variabe is Salesorder), the error is that salesorder is not defined.
But, I have defined the variable in the master page's controller itself.
Now, when I click a particular button, it doesn't loads the master and details page, but it gives an error that sales order is not defined, since master page's controller is called first.
Here are the screen shots:
detail page
Master .controller
Outputscreen
hi sanjo..
why don't you define odata service in your master controller...itself!!
oDataModel.read("/SalesOrderHeaderDetailsInfoSet?$filter= ImSalesorder eq '"+salesOrder+"'and ImUsername eq '"+data.userName+"' ",null,null,false,onSuccessLogin,function(oError){
console.log("error",oError);});
//
var json = new sap.ui.model.json.JSONModel();
json.setData({data1:loginResult.results});
sap.ui.getCore().byId("infoList1").setModel(json);
Hope it's works!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI maksim, I am very new to this, could you please explain in detail how to pass the parameter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same code as you have, just pass salesOrder as
var __SalesOrder = y.SalesOrder;
...toDetail("...","....", { SalesOrder : __SalesOrder });
so in you second page you can read it
page1.addEventDelegate({
onBeforeShow: function(evt) {
//evt.getProperty("data").SalesOrder
},
});
page1 is where you navigate, you can get it from app
why dont you just pass SalesOrder as 3rd param to toDetail
toDetail("","", { SalesOrder : SalesOrder });
* @param {object} oData | |
* This optional object can carry any payload data which should be made available to the target page. The "beforeShow" event on the target page will contain this data object as "data" property. | |
* | |
* Use case: in scenarios where the entity triggering the navigation can or should not directly initialize the target page, it can fill this object and the target page itself (or a listener on it) can take over the initialization, using the given data. | |
* |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the first place this is a *very* simple question!! There are many simpler ways in ui5 we could achieve it. I don't find any reason why variables shouldn't be passed as parameters. Do we define functions without arguments !!
I guess you might have worked out in AngularJs or maybe even a fan of it, but please do consider solutions that UI5 can offer in your answers as its a UI5 community.
yes, 3rd parameter of toDetail method
toDetail = function(pageId, transitionName, data, oTransitionParameters)
Hi Sanjo,
According to your query, what i am getting is that you want to use the variable defined in the Master page onto the detail page.
So, If my understanding is correct, you need to pass this variable from master view to detail view while navigating.
I would not suggest and even not recommended to define the variable globally until n unless you did not find any other way to crack it.
Hope this helps!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
use require to load the controller in order!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
see these link if we use angularjs its very simple.
Link 1. javascript - Scope variable not accessible (undefined) - AngularJS - Stack Overflow
link 2. http://www.johnpapa.net/angularjss-controller-as-and-the-vm-variable/
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.