Skip to content

Commit

Permalink
Selectmenu: Add documentation for _renderButtonItem() extension point
Browse files Browse the repository at this point in the history
Closes gh-226
  • Loading branch information
fnagel authored and scottgonzalez committed Nov 4, 2014
1 parent 166f107 commit 234c811
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions entries/selectmenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,46 @@ _renderMenu: function( ul, items ) {
_resizeMenu: function() {
this.menu.outerWidth( 500 );
}
]]></code>
</example>
</method>
<method name="_renderButtonItem" return="jQuery">
<desc>
<p>Method that controls the creation of the generated button content. The method must create and return a new element.</p>
</desc>
<argument name="item" type="Object">
<property name="disabled" type="Boolean">
<desc>Whether the item is disabled.</desc>
</property>
<property name="element" type="jQuery">
<desc>A reference to the item's original <code>&lt;option&gt;</code> element.</desc>
</property>
<property name="index" type="Number">
<desc>The numeric index of the item.</desc>
</property>
<property name="label" type="String">
<desc>The string to display for the item.</desc>
</property>
<property name="optgroup" type="String">
<desc>If the item is within an <code>&lt;optgroup&gt;</code>, this is set to that <code>&lt;optgroup&gt;</code>'s label.</desc>
</property>
<property name="value" type="String">
<desc>The <code>value</code> attribute of the item's original <code>&lt;option&gt;</code>.</desc>
</property>
</argument>
<example>
<desc>Style the button background color based on the value of the selected option.</desc>
<code><![CDATA[
_renderButtonItem: function( item ) {
var buttonItem = $( "<span>", {
"class": "ui-selectmenu-text"
})
this._setText( buttonItem, item.label );
buttonItem.css( "background-color", item.value )
return buttonItem;
}
]]></code>
</example>
</method>
Expand Down

0 comments on commit 234c811

Please sign in to comment.