Skip to content

Commit 8cf0b10

Browse files
committed
Autocomplete: Document _renderMenu extension point.
1 parent e7dd8df commit 8cf0b10

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

entries/autocomplete.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,29 @@ _renderItem: function( ul, item ) {
203203
.append( $( "<a>" ).text( item.label ) )
204204
.appendTo( ul );
205205
}
206+
]]></code>
207+
</example>
208+
</method>
209+
<method name="_renderMenu">
210+
<desc>
211+
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>.
212+
</desc>
213+
<argument name="ul" type="jQuery">
214+
<desc>An empty <code>&lt;ul&gt;</code> element to use as the widget's menu.</desc>
215+
</argument>
216+
<argument name="items" type="Array">
217+
<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>
218+
</argument>
219+
<example>
220+
<desc>Add a CSS class name to the odd menu items.</desc>
221+
<code><![CDATA[
222+
_renderMenu: function( ul, items ) {
223+
var that = this;
224+
$.each( items, function( index, item ) {
225+
that._renderItemData( ul, item );
226+
});
227+
$( ul ).find( "li:odd" ).addClass( "odd" );
228+
}
206229
]]></code>
207230
</example>
208231
</method>

0 commit comments

Comments
 (0)