The condition result && result.length > 0 is never true because result is an object with no length property.
result: function(value, results) {
var
result = false
;
value = value || module.get.value();
results = results || module.get.results();
if(settings.type === 'category') {
module.debug('Finding result that matches', value);
$.each(results, function(index, category) {
if($.isArray(category.results)) {
result = module.search.object(value, category.results)[0];
if(result && result.length > 0) {
return true;
}
}
});
}
else {
module.debug('Finding result in results object', value);
result = module.search.object(value, results)[0];
}
return result;
},
Also shouldn't the return value be false to exit the loop?
Currently only standard search results work with local search.
Will look at any PR that extends this to work with category search.
Is this still the case? Does this mean it is not possible to have a category search on a local object?
Agreed - why is it not possible to have a category search with a local object? Seems easy enough to me.
It's been 2 years....is this really not implemented yet?
+1 would be nice improvement
I hope this will be implemented some time soon!
Any news on this ?
Using a mockResponse does the job as a temporary fix to make a decoy to remote request and result the results as category
Callback:
$blah.search({
apiSettings: {
mockResponse: function () {
}
}
})
Search settings:
$.extend($.fn.search.settings, {
duration: 0,
searchDelay: 0,
cache: false,
type: 'category',
minCharacters: 1,
selectFirstResult: true
})
Here a working example of category search in local objects
@MarcelWouters, the link is disabled, do you have a code or another link ? :)
@chez-pas-qui try this one http://embed.plnkr.co/UpsopAn0iWCN4cvdLAvL/
@MarcelWouters I'll try it, thank you very much for helping ! :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Most helpful comment
It's been 2 years....is this really not implemented yet?