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

missed one place where id is accessed. issue #51

This commit is contained in:
Igor Vaynberg 2012-05-03 15:05:39 -07:00
parent bf5e7d16de
commit 0160b36a38

5
select2.js Normal file → Executable file
View File

@ -1,4 +1,4 @@
/* /*
Copyright 2012 Igor Vaynberg Copyright 2012 Igor Vaynberg
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in
@ -484,6 +484,7 @@
}); });
query.callback(data); query.callback(data);
}); });
// this is needed because inside val() we construct choices from options and there id is hardcoded
opts.id=function(e) { return e.id; }; opts.id=function(e) { return e.id; };
} else { } else {
if (!("query" in opts)) { if (!("query" in opts)) {
@ -1303,7 +1304,7 @@
throw "Invalid argument: " + selected + ". Must be .select2-search-choice"; throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
} }
index = indexOf(selected.data("select2-data").id, val); index = indexOf(this.id(selected.data("select2-data")), val);
if (index >= 0) { if (index >= 0) {
val.splice(index, 1); val.splice(index, 1);