on 11-10-2018 5:02 AM
Hi Experts,
I am not able to access view parameter in the custom function in the view controller.
I tried this.getview.byid.getvalue / sap.ui.getcire.byid.getvalue but always getting error.
Can you please help and suggest?
Thanks and regards
RK
you have to define the event handler like this if you are doing it in controller,
liveChange: [this.handleLiveUpdateAsset,this]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello ram,
The problem is that the View and the sap.m.Input are not sharing the same context. In other words, both Input field and controller are sharing the same scope, but liveChange does not. That's why you're receiving message "this.getView() is not method and getValue()", the Input field handler is out of the scope.
To make them visible, at the same scope, try to bind the input field with the view while its creation, like this:
var oInput = new sap.m.Input({
type: sap.m.InputType.Text,
id:"serial"+i,
value:(srNumArr[i])?srNumArr[i]:"",
enabled:(srNumArr[i])?false:true,
liveChange: this.handleLiveUpdateAsset, layoutData: new sap.ui.layout.GridData({span: "L10 M10 S9"}), placeholder: "Serial Number"})
}).bind(this);
BR
Arthur Silva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you calling this custom function?
Also could you please share the error or debug message on console?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for(var i=0;i<qtyReceive;i++){ //var n = i;
var oInput = new sap.m.Input({
type: sap.m.InputType.Text,
id:"serial"+i,
value:(srNumArr[i])?srNumArr[i]:"",
enabled:(srNumArr[i])?false:true,
liveChange: this.handleLiveUpdateAsset, layoutData: new sap.ui.layout.GridData({span: "L10 M10 S9"}), placeholder: "Serial Number" });
Upon calling
this.getView().byId('IND').getValue();
It shows this.getView() is not method and getValue() is not defined. It looks like it not able to access this ind parameter. Any help will be appreciated.
Thanks
code please....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
handleLiveUpdateAsset: function(oEvent){
var indicator= this.getView().byId('IND').getValue();
if(indicator !== 'x'){
var itag = oEvent.getParameter("id").substr(6);
var value = oEvent.getParameter("value");
var id = 'asset'+itag;
sap.ui.getCore().byId(id).setValue(value);
}
},
<Input id="IND" width="0.5%" value="{IND}" visible="false"/
Please check thr code and suggest.
Regards,
RK
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
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.