Skip to content

Commit 69396da

Browse files
author
UltCombo
committed
data method use the same triggerChange logic as val method
1 parent 2d58f5b commit 69396da

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
@@ -2285,16 +2285,20 @@ the specific language governing permissions and limitations under the Apache Lic
22852285
},
22862286

22872287
// single
2288-
data: function(value, triggerChange) {
2289-
var data;
2288+
data: function(value) {
2289+
var data,
2290+
triggerChange = false;
22902291

22912292
if (arguments.length === 0) {
22922293
data = this.selection.data("select2-data");
22932294
if (data == undefined) data = null;
22942295
return data;
22952296
} else {
2297+
if (arguments.length > 1) {
2298+
triggerChange = arguments[1];
2299+
}
22962300
if (!value) {
2297-
this.clear(!!triggerChange);
2301+
this.clear(triggerChange);
22982302
} else {
22992303
data = this.data();
23002304
this.opts.element.val(!value ? "" : this.id(value));

0 commit comments

Comments
 (0)