Last active
December 20, 2015 04:58
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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