data method use the same triggerChange logic as val method
This commit is contained in:
parent
2d58f5b084
commit
69396da14f
10
select2.js
10
select2.js
@ -2285,16 +2285,20 @@ 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 (arguments.length > 1) {
|
||||||
|
triggerChange = arguments[1];
|
||||||
|
}
|
||||||
if (!value) {
|
if (!value) {
|
||||||
this.clear(!!triggerChange);
|
this.clear(triggerChange);
|
||||||
} else {
|
} else {
|
||||||
data = this.data();
|
data = this.data();
|
||||||
this.opts.element.val(!value ? "" : this.id(value));
|
this.opts.element.val(!value ? "" : this.id(value));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user