1
0
mirror of synced 2024-11-26 06:46:04 +03:00

Fixed default selections for arrays

This commit is contained in:
Kevin Brown 2014-11-07 19:53:46 -05:00
parent e3deb3ae03
commit d411a0fa76
9 changed files with 22 additions and 26 deletions

View File

@ -1137,7 +1137,8 @@ define('select2/data/select',[
data = { data = {
id: $option.val(), id: $option.val(),
text: $option.html(), text: $option.html(),
disabled: $option.prop('disabled') disabled: $option.prop('disabled'),
selected: $option.prop('selected')
}; };
} else if ($option.is('optgroup')) { } else if ($option.is('optgroup')) {
data = { data = {
@ -1244,9 +1245,9 @@ define('select2/data/array',[
continue; continue;
} }
var option = this.option(item); var $option = this.option(item);
this.$element.append(option); this.$element.append($option);
} }
}; };

View File

@ -1137,7 +1137,8 @@ define('select2/data/select',[
data = { data = {
id: $option.val(), id: $option.val(),
text: $option.html(), text: $option.html(),
disabled: $option.prop('disabled') disabled: $option.prop('disabled'),
selected: $option.prop('selected')
}; };
} else if ($option.is('optgroup')) { } else if ($option.is('optgroup')) {
data = { data = {
@ -1244,9 +1245,9 @@ define('select2/data/array',[
continue; continue;
} }
var option = this.option(item); var $option = this.option(item);
this.$element.append(option); this.$element.append($option);
} }
}; };

View File

@ -10672,7 +10672,8 @@ define('select2/data/select',[
data = { data = {
id: $option.val(), id: $option.val(),
text: $option.html(), text: $option.html(),
disabled: $option.prop('disabled') disabled: $option.prop('disabled'),
selected: $option.prop('selected')
}; };
} else if ($option.is('optgroup')) { } else if ($option.is('optgroup')) {
data = { data = {
@ -10779,9 +10780,9 @@ define('select2/data/array',[
continue; continue;
} }
var option = this.option(item); var $option = this.option(item);
this.$element.append(option); this.$element.append($option);
} }
}; };

File diff suppressed because one or more lines are too long

7
dist/js/select2.js vendored
View File

@ -1565,7 +1565,8 @@ define('select2/data/select',[
data = { data = {
id: $option.val(), id: $option.val(),
text: $option.html(), text: $option.html(),
disabled: $option.prop('disabled') disabled: $option.prop('disabled'),
selected: $option.prop('selected')
}; };
} else if ($option.is('optgroup')) { } else if ($option.is('optgroup')) {
data = { data = {
@ -1672,9 +1673,9 @@ define('select2/data/array',[
continue; continue;
} }
var option = this.option(item); var $option = this.option(item);
this.$element.append(option); this.$element.append($option);
} }
}; };

File diff suppressed because one or more lines are too long

View File

@ -473,15 +473,6 @@ $.fn.select2.amd.require(
var data = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }]; var data = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }];
var data = [];
for (var i = 0; i < 9999; i++) {
data.push({
id: i.toString(),
text: i
});
}
var $ajax = $(".js-example-data-ajax"); var $ajax = $(".js-example-data-ajax");
var $disabledResults = $(".js-example-disabled-results"); var $disabledResults = $(".js-example-disabled-results");

View File

@ -46,9 +46,9 @@ define([
continue; continue;
} }
var option = this.option(item); var $option = this.option(item);
this.$element.append(option); this.$element.append($option);
} }
}; };

View File

@ -158,7 +158,8 @@ define([
data = { data = {
id: $option.val(), id: $option.val(),
text: $option.html(), text: $option.html(),
disabled: $option.prop('disabled') disabled: $option.prop('disabled'),
selected: $option.prop('selected')
}; };
} else if ($option.is('optgroup')) { } else if ($option.is('optgroup')) {
data = { data = {