|
119 | 119 | <desc>Returns a <code>jQuery</code> object containing the button element.</desc>
|
120 | 120 | </method>
|
121 | 121 | </methods>
|
| 122 | + <extension-points> |
| 123 | + <method name="_renderButtonItem" return="jQuery"> |
| 124 | + <desc> |
| 125 | + <p>Method that controls the creation of the generated button content. The method must create and return a new element.</p> |
| 126 | + </desc> |
| 127 | + <argument name="item" type="Object"> |
| 128 | + <property name="disabled" type="Boolean"> |
| 129 | + <desc>Whether the item is disabled.</desc> |
| 130 | + </property> |
| 131 | + <property name="element" type="jQuery"> |
| 132 | + <desc>A reference to the item's original <code><option></code> element.</desc> |
| 133 | + </property> |
| 134 | + <property name="index" type="Number"> |
| 135 | + <desc>The numeric index of the item.</desc> |
| 136 | + </property> |
| 137 | + <property name="label" type="String"> |
| 138 | + <desc>The string to display for the item.</desc> |
| 139 | + </property> |
| 140 | + <property name="optgroup" type="String"> |
| 141 | + <desc>If the item is within an <code><optgroup></code>, this is set to that <code><optgroup></code>'s label.</desc> |
| 142 | + </property> |
| 143 | + <property name="value" type="String"> |
| 144 | + <desc>The <code>value</code> attribute of the item's original <code><option></code>.</desc> |
| 145 | + </property> |
| 146 | + </argument> |
| 147 | + <example> |
| 148 | + <desc>Add a <a href="/theming/icons/">jQuery UI icon</a> to each generated button who's select has a <code>data-icon</code> attribute.</desc> |
| 149 | + <code><![CDATA[ |
| 150 | +_renderButtonItem = function( item ) { |
| 151 | + var buttonItem = $( "<span>", { |
| 152 | + "class": "ui-selectmenu-text" |
| 153 | + }) |
| 154 | + this._setText( buttonItem, item.label ); |
| 155 | +
|
| 156 | + buttonItem |
| 157 | + .css( "padding-left", "2.5em" ) |
| 158 | + .append( "<span>" ) |
| 159 | + .find( "span" ) |
| 160 | + .addClass( "ui-icon " + item.element.attr( "data-icon") ) |
| 161 | + .css( "left", "0.5em" ); |
| 162 | +
|
| 163 | + return buttonItem; |
| 164 | +} |
| 165 | +]]></code> |
| 166 | + </example> |
| 167 | + </method> |
| 168 | + </extension-points> |
122 | 169 | <example>
|
123 | 170 | <desc>A simple jQuery UI Selectmenu</desc>
|
124 | 171 | <code><![CDATA[
|
|
0 commit comments