I'm having a LOT of pain trying to do something very simple : extend a jQuery UI widget, namely the autocomplete one.
Here is what I am doing :
(function($) {
$.widget("my.autocomplete", $.extend({}, $.ui.autocomplete.prototype, {
_create: function() {
$.Widget.prototype._create.apply(this, arguments);
},
}));
})(jQuery);
Of course, it doesn't work even though it is exactly what the official jQuery UI documentation recommends :
http://jqueryui.com/docs/Developer_Guide
Can someone help on this ? I'm confused and have been stuck for many hours now...
Thanks by advance,
Eric.
The basic formatting of the accordion is done by the CSS for jQuery UI, but you can use CSS to format the contents within the panels.
a jQuery UI widget is a specialized jQuery plug-in. Using plug-in, we can apply behaviours to the elements. However, plug-ins lack some built-in capabilities, such as a way to associate data with its elements, expose methods, merge options with defaults, and control the plug-in's lifetime.
The widget factory defines how to create and destroy widgets, get and set options, invoke methods, and listen to events triggered by the widget. By using the widget factory to build your stateful plugins, you are automatically conforming to a defined standard, making it easier for new users to start using your plugins.
OK, I've found the answer after many hours of confusion :
$.ui.autocomplete.prototype._create.apply(this, arguments);
Instead of :
$.Widget.prototype._create.apply(this, arguments);
Working like a charm...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With