cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Checkboxes in ui5

Former Member
0 Likes
2,541

Hi,

I have 2 checkboxes on the screen(checkbox1,checkbox2), my requireemnt is to by default checkbox1 is selected, which is done . now when checkbox2 is selected then checkbox 1 gets unchecked , and vice a versa.

code i m writting for the same is :

// create a simple CheckBox

  new sap.ui.commons.CheckBox({

  id : "checkbox1",

  text : "checkbox1",,

  tooltip : 'Commercial Customer',

  checked : false,

  enabled : true,

  change : function(){

  alert("commercial selected");

  sap.ui.getCore().byId("checkbox2").setChecked(false);

  }

new sap.ui.commons.CheckBox({

id : "checkbox2",

checked : true,

enabled : true,

change : function(){

alert("residentail selected");

sap.ui.getCore().byId("checkbox1").setChecked(false);

}

Alers are coming but the toggling of the checkboxes are not working.

Secondly in additons to this I have to make some fields visible or hidden.

Thanks in advance

Pooja

View Entire Topic
JoseMunoz
Active Participant
0 Likes

Hi,

You have here a working example:

http://jsbin.com/hidafu/edit?html,js,console,output

For visible or not, you can use the method setVisible.

Regards

Former Member
0 Likes

Hello Jose,

This is the same code I have written but is not working in my case.

Thanks

Pooja

JoseMunoz
Active Participant
0 Likes

Hi,

Yes, I started with your code, but for me is working. I'm using Chrome latest version and IE 11.

Do you have an error message in the console?

Thanks a lot

Former Member
0 Likes

Thanks Jose,

There was some issue with other function defined in the view hence the code you suggested didn't worked for me...but it is now .

Pooja