Added the multiple selection support in the Select2Cell

pull/3/head
Harshal Dhumal 2016-05-10 13:48:48 +05:30 committed by Ashesh Vashi
parent 817bdd0108
commit 176b99c90b
1 changed files with 10 additions and 9 deletions

View File

@ -469,12 +469,18 @@
var optionText = null, var optionText = null,
optionValue = null, optionValue = null,
self = this,
model = this.model, model = this.model,
selectedValues = model.get(this.column.get("name")); selectedValues = model.get(this.column.get("name")),
select2_opts = _.extend(
{openOnEnter: false, multiple:false}, self.defaults.select2,
(col.select2 || {})
),
selectTpl = _.template('<select <%=multiple ? "multiple" : "" %>></select>');
delete this.$select; $select = self.$select = $(selectTpl({
self = this, multiple: select2_opts.multiple
$select = self.$select = $('<select></select>').appendTo(this.$el); })).appendTo(self.$el);
for (var i = 0; i < optionValues.length; i++) { for (var i = 0; i < optionValues.length; i++) {
var opt = optionValues[i]; var opt = optionValues[i];
@ -500,11 +506,6 @@
} }
} }
var select2_opts = _.extend(
{openOnEnter: false},
col.select2, this.defaults.select2
);
if(col && _.has(col.disabled)) { if(col && _.has(col.disabled)) {
_.extend(select2_opts, { _.extend(select2_opts, {
disabled: evalF(col.disabled, col, model) disabled: evalF(col.disabled, col, model)