Skip to content

Commit

Permalink
Autocomplete: Document _renderMenu extension point.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjvantoll committed Sep 26, 2013
1 parent e7dd8df commit 8cf0b10
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions entries/autocomplete.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -203,6 +203,29 @@ _renderItem: function( ul, item ) {
.append( $( "<a>" ).text( item.label ) ) .append( $( "<a>" ).text( item.label ) )
.appendTo( ul ); .appendTo( ul );
} }
]]></code>
</example>
</method>
<method name="_renderMenu">
<desc>
Method that controls building the widget's menu. The method is passed an empty <code>&lt;ul&gt;</code> and an array of items that match the user typed term. Creation of the individual <code>&lt;li&gt;</code> elements should be delegated to <code>_renderItemData()</code>.
</desc>
<argument name="ul" type="jQuery">
<desc>An empty <code>&lt;ul&gt;</code> element to use as the widget's menu.</desc>
</argument>
<argument name="items" type="Array">
<desc>An Array of items that match the user typed term. Each item is an Object with <code>label</code> and <code>value</code> properties.</desc>
</argument>
<example>
<desc>Add a CSS class name to the odd menu items.</desc>
<code><![CDATA[
_renderMenu: function( ul, items ) {
var that = this;
$.each( items, function( index, item ) {
that._renderItemData( ul, item );
});
$( ul ).find( "li:odd" ).addClass( "odd" );
}
]]></code> ]]></code>
</example> </example>
</method> </method>
Expand Down

0 comments on commit 8cf0b10

Please sign in to comment.