Path

ez projects / ngsuggest / forum / general / wish number of results in t... / re: wish number of results...


Wish number of results in the drop downlist, so i did it !

You need to be logged in to post messages in the forums. New users may register here.

Olivier Portier

Member since:
04 April 2008

Posts: 7

Wednesday 23 June 2010 2:57:51 pm

Hi Ivo,

I wish to have the number of results in the drop down suggestion list. So, i did a little patch in the javascripts files.

If your are interested in this feature, i can post a patch by email or by SVN. Here is my code with the Google strong look-a-like:

file: ngSuggest.js
line: 14,
function processJSONData(data) {
for (var f in data.facet_counts.facet_fields) {
for (var i in data.facet_counts.facet_fields[f]) {
if (i%2 == 0) {
if (i != 0) JSONData += ',';
JSONData += '{"text":"' + data.facet_counts.facet_fields[f][i] + '"';
}
else
{
JSONData += ', "num":"' + data.facet_counts.facet_fields[f][i] + '"}';
}
success = true;
}
}
}

file: jquery.jsonSuggest-dev.js
line: 156
if (settings.highlightMatches === true) {
text = text.replace(filterPatt, "$1<strong>");
text = text + '</strong>' + ' (' + resultObjects[i].num + ')';
}

Thanks again for this cool feature.
Olivier
Up

Ivo Lukač

Member since:
06 May 2005

Posts: 35

Tuesday 27 July 2010 1:29:16 pm

Hi Olivier,

Going to put it in the next release :) Thanks
Up

You need to be logged in to post messages in the forums. New users may register here.