1
0
mirror of synced 2024-11-26 14:56:07 +03:00

Merge pull request #1563 from UltCombo/1562

Fixes #1562 do not trigger change on $().select2('data') unless specified with the second param
This commit is contained in:
Igor Vaynberg 2013-07-30 09:41:56 -07:00
commit 2ab64be416

View File

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