If yes, could an example be provided:
Currenly this is what I have, but after calling the constructor it will be missing an argument.
$.fn.select2.amd.define(
'select2/dropdown/customAttachBody',
[
'select2/dropdown/attachBody',
'select2/utils'
],
function (AttachBody, Utils) {
function customAttachBody() {
console.log(arguments);
customAttachBody.__super__.constructor.apply(this, arguments);
}
Utils.Extend(customAttachBody, AttachBody);
customAttachBody.prototype._positionDropdown = function () {
debugger;
}
return Utils.Decorate(customAttachBody, AttachBody);
}
);
var customAdapter = $.fn.select2.amd.require('select2/dropdown/customAttachBody');
/**/
$('select').select2({
dropdownAdapter: customAdapter
});
/**/
Did you happen to get this figured out?
$.fn.select2.amd.require(
[
'select2/dropdown/attachBody'
],
function (AttachBody) {
// simple override
AttachBody.prototype._positionDropdown = function () {
// override code here
};
// or if you want to keep access to the original method
AttachBody.prototype._positionDropdown = (function (originalMethod) {
return function () {
// override code here
}
}(AttachBody.prototype._positionDropdown));
},
undefined,
true
);
Works fine like this.
Remember to execute the file where this code is set after the select2.js file.
Che
You're a champ! Thank you sir!
This works great, but I would still be interested in how to utilize this as a dropdownAdapter. I am going to cross post on stackoverflow.com