on 2014 Dec 09 11:10 PM
hi,
i've a bar declaration in my xml.view like below:
<m:Bar id="idBar" visible="false"> | ||||
<m:contentRight > | ||||
<m:Button | ||||
id = "idBtnAddCart" | ||||
text = "Submit" | ||||
type = "Emphasized" | ||||
icon = "sap-icon://cart" | ||||
press = "pressSubmit" | ||||
visible="true" | ||||
> | ||||
</m:Button> | ||||
</m:contentRight> | ||||
</m:Bar> |
and i've below on one of the actions:
this.byId("idBar").setVisible(true);
and when clicked on the action button, it shows me:
Uncaught TypeError: Cannot read property 'id' of undefined
can i set visibility on BAR <Mobile>? is it valid to do that? other ui controls works.. but not BAR.
i've anyways handled it in a different way, but wanted to know why its giving error.
Hi,
within your controller method you have to use this.getView().byId("idBar").setVisible(true). So the unique ID support is also considered.
Best regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
since this is an xml view, this.getView().byId("idBar") will not work....xml view adds a prefix to the control ids..
you have to use
this.getView().byId("viewID--idBar") , where viewID is the id you have assigned to the view somewhere
if you are in the controller, you should do this.getView().byId("idBar") ...this will also work..if it does not work, then check for 'this' ..that could be the local event instead of the controller...
Please paste the relevant code to JS Bin. So we can help you.
try sap.ui.getCore().byId("yourId")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
65 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.