|
@@ -15,7 +15,7 @@ define([
|
|
var data = [];
|
|
var data = [];
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
- this.$element.find(":selected").each(function () {
|
|
|
|
|
|
+ this.$element.find(':selected').each(function () {
|
|
var $option = $(this);
|
|
var $option = $(this);
|
|
|
|
|
|
var option = self.item($option);
|
|
var option = self.item($option);
|
|
@@ -29,7 +29,7 @@ define([
|
|
SelectAdapter.prototype.select = function (data) {
|
|
SelectAdapter.prototype.select = function (data) {
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
- if (this.$element.prop("multiple")) {
|
|
|
|
|
|
+ if (this.$element.prop('multiple')) {
|
|
this.current(function (currentData) {
|
|
this.current(function (currentData) {
|
|
var val = [];
|
|
var val = [];
|
|
|
|
|
|
@@ -45,20 +45,20 @@ define([
|
|
}
|
|
}
|
|
|
|
|
|
self.$element.val(val);
|
|
self.$element.val(val);
|
|
- self.$element.trigger("change");
|
|
|
|
|
|
+ self.$element.trigger('change');
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
var val = data.id;
|
|
var val = data.id;
|
|
|
|
|
|
this.$element.val(val);
|
|
this.$element.val(val);
|
|
- this.$element.trigger("change");
|
|
|
|
|
|
+ this.$element.trigger('change');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
SelectAdapter.prototype.unselect = function (data) {
|
|
SelectAdapter.prototype.unselect = function (data) {
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
- if (!this.$element.prop("multiple")) {
|
|
|
|
|
|
+ if (!this.$element.prop('multiple')) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -74,27 +74,27 @@ define([
|
|
}
|
|
}
|
|
|
|
|
|
self.$element.val(val);
|
|
self.$element.val(val);
|
|
- self.$element.trigger("change");
|
|
|
|
|
|
+ self.$element.trigger('change');
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
SelectAdapter.prototype.bind = function (container, $container) {
|
|
SelectAdapter.prototype.bind = function (container, $container) {
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
- container.on("select", function (params) {
|
|
|
|
|
|
+ container.on('select', function (params) {
|
|
self.select(params.data);
|
|
self.select(params.data);
|
|
});
|
|
});
|
|
|
|
|
|
- container.on("unselect", function (params) {
|
|
|
|
|
|
+ container.on('unselect', function (params) {
|
|
self.unselect(params.data);
|
|
self.unselect(params.data);
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
SelectAdapter.prototype.query = function (params, callback) {
|
|
SelectAdapter.prototype.query = function (params, callback) {
|
|
var data = [];
|
|
var data = [];
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
- this.$element.find("option").each(function () {
|
|
|
|
|
|
+ this.$element.find('option').each(function () {
|
|
var $option = $(this);
|
|
var $option = $(this);
|
|
|
|
|
|
var option = self.item($option);
|
|
var option = self.item($option);
|
|
@@ -108,7 +108,7 @@ define([
|
|
};
|
|
};
|
|
|
|
|
|
SelectAdapter.prototype.item = function ($option) {
|
|
SelectAdapter.prototype.item = function ($option) {
|
|
- var data = $option.data("data");
|
|
|
|
|
|
+ var data = $option.data('data');
|
|
|
|
|
|
// If the data has already be generated, use it
|
|
// If the data has already be generated, use it
|
|
if (data == null) {
|
|
if (data == null) {
|
|
@@ -117,14 +117,14 @@ define([
|
|
text: $option.html()
|
|
text: $option.html()
|
|
};
|
|
};
|
|
|
|
|
|
- $option.data("data", data);
|
|
|
|
|
|
+ $option.data('data', data);
|
|
}
|
|
}
|
|
|
|
|
|
return data;
|
|
return data;
|
|
};
|
|
};
|
|
|
|
|
|
SelectAdapter.prototype.matches = function (params, data) {
|
|
SelectAdapter.prototype.matches = function (params, data) {
|
|
- if ($.trim(params.term) == "") {
|
|
|
|
|
|
+ if ($.trim(params.term) === '') {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,7 +133,7 @@ define([
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
return false;
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
return SelectAdapter;
|
|
return SelectAdapter;
|
|
});
|
|
});
|