Skip to content

Instantly share code, notes, and snippets.

@adamboduch
Last active December 20, 2015 04:58
Show Gist options
  • Save adamboduch/6074338 to your computer and use it in GitHub Desktop.
Save adamboduch/6074338 to your computer and use it in GitHub Desktop.
In chapter 2, of "jQuery UI Cookbook", there are some issues with category sorting in IE 10. Thanks to Dave Sharman for providing the solution.
$.widget( "ab.autocomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var that = this,
currentCategory = "";
// This should be returning integers, not booleans.
items.sort( function( a, b ) {
if ( a.cat > b.cat ) {
return 1;
}
if ( a.cat < b.cat ) {
return -1;
}
return 0;
});
$.each( items, function( index, item ) {
if ( item.cat != currentCategory ) {
that._renderCategory( ul, item );
currentCategory = item.cat;
}
that._renderItemData( ul, item );
});
},
// The rest of the widget customization...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment