Search code examples
google-fusion-tables

How can I generate an error message when text search of Google Fusion Table gets zero results?


I have a map that's internal so I can't show it, but this example shows the kind of text search that I have: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/change_query_text_input.html

When the user searches for something with zero results, I would like a simple JavaScript alert box to pop up. Or some other way of letting the user know the search is working, there just aren't any results for his search. In the example linked above, nothing happens if there are no search results, which isn't very user-friendly.

Can somebody give me a code snippet to accomplish that for the linked example?

Thanks!


Solution

  • The linked example uses a FusionTablesLayer, a FusionTablesLayer doesn't give any information about the result of the Query.

    You'll need to send a query by using the REST-API (JSONP is supported) to get details like e.g. the number of rows