If you want to customize the appearance of the jQuery autocomplete suggestion result set, you have to replace the _renderItem function with your own creation that produces the desired result. The function definition will be as follows.
$(function () {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1");
return $(" ")
.data("item.autocomplete", item)
.append("" + item.label + "")
.appendTo(ul);
};
//attach your autocomplete to the textbox. See my previous post http://ssenarath.blogspot.com/2014/06/jquery-autocomplete-suggest-size-is.html
$("#ContentPlaceHolder1_txtDesignation").autocomplete({
...
});
});
A complete discussion of similar topic can be found in http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results
Cheers
Samittha
$(function () {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1");
return $(" ")
.data("item.autocomplete", item)
.append("" + item.label + "")
.appendTo(ul);
};
//attach your autocomplete to the textbox. See my previous post http://ssenarath.blogspot.com/2014/06/jquery-autocomplete-suggest-size-is.html
$("#ContentPlaceHolder1_txtDesignation").autocomplete({
...
});
});
A complete discussion of similar topic can be found in http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results
Cheers
Samittha
No comments:
Post a Comment