Hello.
I have a multiselect combobox with checkeboxes. Let assume that variable "options" has value "Building 1, Building 2". My combobox has items "Building 1", "Building 2", "Building 3". I want to by using JS select and check those two values. This code check Building 1 and Building 2, but only Building 2 is really selected.
I have a multiselect combobox with checkeboxes. Let assume that variable "options" has value "Building 1, Building 2". My combobox has items "Building 1", "Building 2", "Building 3". I want to by using JS select and check those two values. This code check Building 1 and Building 2, but only Building 2 is really selected.
function
setValuesInCombobox(options) {
var
controler =$find(getClientIdById(cboBuildingControlName));
controler.set_value(options);
controler.set_text(options);
var
allChoicesFromCbo = controler.get_items()._array;
var
selectedOptions = options.split(
","
);
for
(i = 0; i < selectedOptions.length; i++) {
var
building = selectedOptions[i].trim();
for
(j = 0; j < allChoicesFromCbo.length; j++) {
var
nameOfBuildingInCbo = allChoicesFromCbo[j]._properties._data.value;
if
( nameOfBuildingInCbo == building) {
allChoicesFromCbo[j]._setChecked(
true
);
allChoicesFromCbo[j].select();
}
}
}