Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The widget factory provides a way to extend from an existing widget with <code>$.widget</code> constructor:</p> <pre><code>$.widget("ui.MyExtWidget", $.ui.MyWidget, { options: { alertText: '' }, myNewMethod: function() { alert('Value1 = ' + this.options.Value1); alert('alertText = ' + this.options.alertText); } }); </code></pre> <p><strong>Note:</strong> The constructor will take care of extending the options as well. This is the method used in the jQuery UI library itself. For instance, the widget <code>ui.mouse</code> has options and a lot of the other widgets inherits from it and have their own extra options along with the ones from ui.mouse.</p> <p><strong><a href="http://jsfiddle.net/didierg/3ZTne/" rel="nofollow">DEMO</a></strong></p> <hr> <p>From the Widget Factory <a href="http://wiki.jqueryui.com/w/page/12138135/Widget%20factory" rel="nofollow">wiki post</a>: </p> <blockquote> <p>The widget factory is a simple function on the global jQuery object - jQuery.widget - that accepts 2 or 3 arguments.</p> <p>jQuery.widget("namespace.widgetname", <strong>/* optional - an existing widget prototype to inherit from <em>/</strong>, /</em> An object literal to become the widget's prototype*/ {...} ); </p> <p><strong>The second (optional) argument is a widget prototype to inherit from</strong>. For instance, jQuery UI has a "mouse" plugin on which the rest of the interaction plugins are based. In order to achieve this, draggable, droppable, etc. all inherit from the mouse plugin like so: jQuery.widget( "ui.draggable", $.ui.mouse, {...} ); If you do not supply this argument, the widget will inherit directly from the "base widget," jQuery.Widget (note the difference between lowercase "w" jQuery.widget and uppercase "W" jQuery.Widget).</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload