CLOUDSTACK-4302: Instance wizard: Support readonly checkbox selection

If 'selectedObjNonEditable' option is passed alongside 'selectedObj'
on response, make checkbox selection readonly/disabled.

Right now this is to support 'required' affinity group selections that
shouldn't be unselected.
This commit is contained in:
Brian Federle 2013-08-13 14:26:41 -07:00
parent 9375aa9467
commit 530df8c843
1 changed files with 11 additions and 2 deletions

View File

@ -90,7 +90,7 @@
});
};
var makeSelects = function(name, data, fields, options, selectedObj) {
var makeSelects = function(name, data, fields, options, selectedObj, selectedObjNonEditable) {
var $selects = $('<div>');
options = options ? options : {};
@ -163,6 +163,14 @@
if (selectedObj != null && selectedObj.id == item.id) {
$select.find('input[type=checkbox]').attr('checked', 'checked');
if (selectedObjNonEditable) {
$select.find('input[type=checkbox]').attr('disabled', 'disabled');
$select.find('input[type=checkbox]').clone().attr({
type: 'hidden',
disabled: false
}).appendTo($selects);
}
}
$selects.append($select);
@ -521,7 +529,8 @@
type: 'checkbox',
'wizard-field': 'affinity-groups'
},
args.data.selectedObj
args.data.selectedObj,
args.data.selectedObjNonEditable
)
);
} else {