diff options
Diffstat (limited to 'public/bower_components/select2/src/js/select2/data/base.js')
-rw-r--r-- | public/bower_components/select2/src/js/select2/data/base.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/public/bower_components/select2/src/js/select2/data/base.js b/public/bower_components/select2/src/js/select2/data/base.js new file mode 100644 index 0000000..e35054d --- /dev/null +++ b/public/bower_components/select2/src/js/select2/data/base.js @@ -0,0 +1,40 @@ +define([ + '../utils' +], function (Utils) { + function BaseAdapter ($element, options) { + BaseAdapter.__super__.constructor.call(this); + } + + Utils.Extend(BaseAdapter, Utils.Observable); + + BaseAdapter.prototype.current = function (callback) { + throw new Error('The `current` method must be defined in child classes.'); + }; + + BaseAdapter.prototype.query = function (params, callback) { + throw new Error('The `query` method must be defined in child classes.'); + }; + + BaseAdapter.prototype.bind = function (container, $container) { + // Can be implemented in subclasses + }; + + BaseAdapter.prototype.destroy = function () { + // Can be implemented in subclasses + }; + + BaseAdapter.prototype.generateResultId = function (container, data) { + var id = container.id + '-result-'; + + id += Utils.generateChars(4); + + if (data.id != null) { + id += '-' + data.id.toString(); + } else { + id += '-' + Utils.generateChars(4); + } + return id; + }; + + return BaseAdapter; +}); |