on 2015 Mar 02 2:09 PM
Hello guys!
I'm quite new in SAPUI5 development, and I'm trying to do a simple show and hide feature on my UI5 CRUD.
I believe this fairly simple thing to do, but maybe I'm calling the function how it is supposed to.
Here's how I'm trying to do it:
On the View:
--------------------------------------------------------------------------------------------------------------
// the check box
var projectExtendedCheckBox = new sap.m.CheckBox(this.createId("extended-checkbox"),{
selected : false,
enabled : true,
select : $.proxy(oController.handleHide)()
});
//the fields and labels
var projectCurrencyInput = new sap.m.Input(this.createId("currency-input"), {
value: "EUR",
visible:false
});
var projectCurrencyInputLabel = new sap.m.Label(this.createId("currency-label"),{
text: "Currency",
labelFor: projectCurrencyInput.getId(),
visible:false
});
On the Controller:
--------------------------------------------------------------------------------------------------------------
//the function
handleHide : function(oEvent){
var costLbl = this.oView().byId("cost-input-label");
var checkBox = this.getView().byId("extended-checkbox");
if(checkBox.getSelected()){
costLbl.setVisible(true);
}
},
Hello Rodrigo,
Here is a JS Bin sample which sets Label and Input control visibility using a CheckBox.
In creating the sample, I did notice your handleHide function gets id "cost-input-label" instead of id "currency-input".
Regards,
Scott
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
7 | |
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.