[ 4 posts ]

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

AutoComplete widget with resultFormatter breaks Highlight

Post Posted: Wed Feb 08, 2012 10:48 am
+0-
Hello,
I have noticed that adding resultFormatter that formats html fragment for list rows breaks Highlight (resultHighlighter). Is it a known problem or I am missing something?

This is test case: type 'f':
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>

<div id="demo" class="yui3-skin-sam">
<label for="ac-input">Enter a symbol or company name:</label><br>
<input id="ac-input" type="text">
</div>

<script>
YUI().use('yql', 'autocomplete', 'autocomplete-highlighters', function (Y) {

var tweetTemplate =
'<div>' +
'<span>{symbol}</span>' +
'</div>';

Y.one('#ac-input').plug(Y.Plugin.AutoComplete, {
resultFormatter: function (query, results) {
return Y.Array.map(results, function (result) {
var symbolInfo = result.raw;

return Y.Lang.sub(tweetTemplate, {
symbol: symbolInfo.symbol
});
});
},
resultHighlighter: 'phraseMatch',
resultTextLocator: 'symbol',
source: function (query, callback) {
return [{ symbol: 'foo' }, { symbol: 'bar'}];
}
});
});
</script>
Thanks

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

Re: AutoComplete widget with resultFormatter breaks Highligh

Post Posted: Wed Feb 08, 2012 11:41 am
+0-
I resolved it, kind of, by calling Y.Highlight.all(parameter, query).

Raj A

  • Username: yoursking
  • Joined: Sat May 04, 2013 12:47 pm
  • Posts: 9
  • GitHub: yoursking57
  • Gists: yoursking57
  • IRC: Raj
  • Offline
  • Profile

Re: AutoComplete widget with resultFormatter breaks Highligh

Post Posted: Sat May 04, 2013 1:00 pm
+0-
I have same issues. Can I get the sample code?

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: AutoComplete widget with resultFormatter breaks Highligh

Post Posted: Mon May 06, 2013 11:16 pm
+0-
Hello Raj.

I replied you in the following post:
viewtopic.php?p=39148

Regards,
IceBox

P.S.: This is the third post about the same topic. Use only one, please.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum