Hi,
How can I customize which data appears on searchbox results?
I need results like this: "Street name, city, state" (maybe country at the end), but all samples from Nokia developers site is showing only the street name.
Printable View
Hi,
How can I customize which data appears on searchbox results?
I need results like this: "Street name, city, state" (maybe country at the end), but all samples from Nokia developers site is showing only the street name.
Which samples are you referring to ?
Basically if you can modify the codes, you should be able to change the appearance as well, so what have you tried sofar ?
I've used the samples from [url]http://api.maps.nokia.com/en/playground/env/desktop/#ex_places_example_basic_search_box_desc[/url]
I didn't find the option to add the city name to each result line.
if you check the code, its simple as:
[code]
var result,
resultsElt = document.getElementById("basicSearchBoxResults");
resultsElt.innerHTML = "",
i, len;
for (var i = 0, len = data.results.items.length; i < len ; i++) {
result = data.results.items[i],
liElt = document.createElement("li");
liElt.innerHTML = result.title;
resultsElt.appendChild(liElt);
}
[/code]
So you could make your own elements you add there and have any data you wish put in there, as well as use which ever CSS style you would want to use.
I've already seen this code sample, but it just allows to customize the results (in fact, what I need to customize is the suggest list, sorry for the wrong information).
I searched on the API documentation and found the suggestions option for the searchbox object, but I need to define a template for this suggestion list pop up.
Here is the code added to the SearchBox initialization:
suggestions: { showAddress: true }
How can I define the template for the suggestions list?
Thanks