Skip to Content

Enable or disable checkboxes

Hi All:

I have a list of checkboxes that are dynamically created in a list:

new sap.m.VBox({

items: {

path: "T_OBJECTS_ASSI",

template: new sap.m.CheckBox({

//enabled: ifEditMode,

},

selected: {

parts: [{path: "SELECTED"}],

formatter: function(SELECTED){return SELECTED == 'X';}

},

text : "{DESCRIPTION}",

})

}

})

I like to disable all the checkboxes until a user clicks the edit button and then the checkboxes should become enabled. I tried a few things but no luck.

Could anyone help or advise please?

Thanks so much in advance.

Ron

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 14, 2014 at 03:32 PM

    Hi,

    You could use the enabled option and bind it to your model. For example:

    var oCB = new sap.ui.commons.CheckBox({

    text : 'I want to receive the newsletter',

    tooltip : 'Newsletter checkbox',

    checked : true,

    change : function() {if(oCB.getChecked()){alert('YES')}else{alert('NO')};},

    enabled : {model>/checkboxStatus}

    });

    https://openui5.hana.ondemand.com/#test-resources/sap/ui/commons/demokit/CheckBox.html

    Kind regards,

    Wouter

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.