Hi,
I am creating a custom masthead from scratch using LSAPI. Need to add a search which would search for suggestions in the Portal Navigation, just like the standard search works in AFP
This is what I have tried so far
var filter = new (EPCM.getSAPTop()).SuggestionFilter(); filter.setNumSuggestions(22); filter.setSearchOption( EPCM.getSAPTop().SearchOption.contains ); filter.setCategories("Documents;Navigation"); EPCM.getSAPTop().LSAPI.suggestionPlugin.getSuggestions("My", suggestionCallback, filter); function suggestionCallback( searchTerm, suggestions ) { if( !suggestions ) // no suggestions passed { return; } // Loop through the suggestions array and retrieves their data. for(var i = 0 ; i < suggestions.length ; i++) { var suggestion = suggestions[i]; var url = suggestion.getURL(); var title = suggestion.getTitle(); var tooltip = suggestion.getTooltip(); var navMode = suggestion.getNavMode(); var categoryTitle = suggestion.getGroupTitle(); var iconURL = suggestion.getIconURL(); var providerId = suggestion.getProviderId(); } }
But it errors out - Uncaught TypeError: Cannot read property 'contains' of undefined(…)
Any pointers on how to fix this?
Thanks
Sandip