Select2Cell: Check if cell is in multiselect mode before setting default selection of multiple values. Fixes #2283

This commit is contained in:
Harshal Dhumal 2017-03-23 10:45:42 +00:00 committed by Dave Page
parent 5b12fd6d5f
commit 720aefbe6f

View File

@ -648,12 +648,12 @@
label: optionText, label: optionText,
value: optionValue, value: optionValue,
selected: (selectedValues == optionValue) || selected: (selectedValues == optionValue) ||
(_.indexOf(selectedValues, optionValue) > -1) (select2_opts.multiple && _.indexOf(selectedValues, optionValue) > -1)
})); }));
} else { } else {
opt = _.defaults({}, opt, { opt = _.defaults({}, opt, {
selected: ((selectedValues == opt.value) || selected: ((selectedValues == opt.value) ||
(_.indexOf(selectedValues, opt.value) > -1)), (select2_opts.multiple && _.indexOf(selectedValues, opt.value) > -1)),
}, self.defaults.opt); }, self.defaults.opt);
$select.append(self.template(opt)); $select.append(self.template(opt));
} }