Skip to content

Commit 2ab64be

Browse files
committed
Merge pull request select2#1563 from UltCombo/1562
Fixes select2#1562 do not trigger change on $().select2('data') unless specified with the second param
2 parents 28ea518 + 69396da commit 2ab64be

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

select2.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,15 +2294,19 @@ the specific language governing permissions and limitations under the Apache Lic
22942294
},
22952295

22962296
// single
2297-
data: function(value, triggerChange) {
2298-
var data;
2297+
data: function(value) {
2298+
var data,
2299+
triggerChange = false;
22992300

23002301
if (arguments.length === 0) {
23012302
data = this.selection.data("select2-data");
23022303
if (data == undefined) data = null;
23032304
return data;
23042305
} else {
2305-
if (!value || value === "") {
2306+
if (arguments.length > 1) {
2307+
triggerChange = arguments[1];
2308+
}
2309+
if (!value) {
23062310
this.clear(triggerChange);
23072311
} else {
23082312
data = this.data();

0 commit comments

Comments
 (0)