1
0
mirror of synced 2025-02-16 20:13:16 +03:00

data method use the same triggerChange logic as val method

This commit is contained in:
UltCombo 2013-07-25 21:41:22 -03:00
parent 2d58f5b084
commit 69396da14f

View File

@ -2285,16 +2285,20 @@ the specific language governing permissions and limitations under the Apache Lic
},
// single
data: function(value, triggerChange) {
var data;
data: function(value) {
var data,
triggerChange = false;
if (arguments.length === 0) {
data = this.selection.data("select2-data");
if (data == undefined) data = null;
return data;
} else {
if (arguments.length > 1) {
triggerChange = arguments[1];
}
if (!value) {
this.clear(!!triggerChange);
this.clear(triggerChange);
} else {
data = this.data();
this.opts.element.val(!value ? "" : this.id(value));