update integration docs

correct the code example to avoid infinite loop

the infinite loop occure because the code example also
update the value on change handler. issue #954.
prove https://jsfiddle.net/syaiful6/kps3gabo/
This commit is contained in:
Syaiful Bahri 2016-06-05 04:32:22 +07:00
parent 474c43e433
commit 52b0918297

View file

@ -38,7 +38,7 @@ var Select2 = {
if (!isInitialized) { if (!isInitialized) {
el.select2() el.select2()
.on("change", function(e) { .on("change", function(e) {
var id = el.select2("val"); var id = el.val();
m.startComputation(); m.startComputation();
//Set the value to the selected option //Set the value to the selected option
ctrl.data.map(function(d){ ctrl.data.map(function(d){
@ -48,7 +48,7 @@ var Select2 = {
}); });
if (typeof ctrl.onchange == "function"){ if (typeof ctrl.onchange == "function"){
ctrl.onchange(el.select2("val")); ctrl.onchange(el.val());
} }
m.endComputation(); m.endComputation();
}); });