autocomplete UI: can't select rows with custom HTML
Hi Guys
I've overridden the _renderMenu and _renderItem functions in the autocomplete UI based on a suggestion here:
Quick example of multi-column results with jQueryUI's new Autocomplete? so I can implement an HTML table showing the autocomplete suggestions. It displays fine, but I can no longer click any rows or even highlight/navigate with the arrows. Can anyone suggest what might ber wrong /missing?
- $(document).ready(function() {
- $.ui.autocomplete.prototype._renderMenu = function(ul, items) {
- var self = this;
- ul.append("<table><thead><tr><th>HIN</th><th style='text-align: left;'>Description</th></tr></thead><tbody></tbody></table>");
- $.each( items, function( index, item ) {
- self._renderItem( ul.find("table tbody"), item );
- });
- };
- $.ui.autocomplete.prototype._renderItem = function(table, item) {
- return $( "<tr></tr>" )
- .data( "item.autocomplete", item )
- .append( "<td>"+item.hin+"</td>"+"<td>"+item.value+"</td>" )
- .appendTo( table );
- };
- $("input#sku").autocomplete(
- {
- source: "search.php?a=0&b=1",
- minLength: 3
- }
- );
- });
Many thanks