I am trying to make a searchable map with the great template Derek made.
I have tried everything but somehow I do not manage to get my result list to display. Div is visible but no results. Hope someone can help me. I followed these instructions:
This is part of the index
<a class='btn btn-primary' id='search' href='#'>
<i class='glyphicon glyphicon-search'></i>
Zoeken
</a>
<a class='btn btn-default' id='reset' href='#'>
<i class='glyphicon glyphicon-repeat'></i>
Reset
</a>
</div>
<div class='alert alert-info' id='result_box' ><strong id='result_count'></strong></div>
<div class='well'> <div id='results_list'></div> </div>
</div>
<div class='col-md-8'>
<noscript>
<div class='alert alert-info'>
<h4>Your JavaScript is disabled</h4>
<p>Please enable JavaScript to view the map.</p>
</div>
</noscript>
<div id='map_canvas'></div>
And this the maps_lib.js
submitSearch: function(whereClause, map, location) {
//get using all filters
//NOTE: styleId and templateId are recently added attributes to load custom marker styles and info windows
//you can find your Ids inside the link generated by the 'Publish' option in Fusion Tables
//for more details, see https://developers.google.com/fusiontables/docs/v1/using#WorkingStyles
MapsLib.searchrecords = new google.maps.FusionTablesLayer({
query: {
from: MapsLib.fusionTableId,
select: MapsLib.locationColumn,
where: whereClause
},
styleId: 2,
templateId: 2
});
MapsLib.searchrecords.setMap(map);
MapsLib.getCount(whereClause);
MapsLib.getList(whereClause);},
And this:
getCount: function(whereClause) {
var selectColumns = "Count()";
MapsLib.query(selectColumns, whereClause, "", "", "MapsLib.displaySearchCount");
},
displaySearchCount: function(json) {
MapsLib.handleError(json);
var numRows = 0;
if (json["rows"] != null)
numRows = json["rows"][0];
var name = MapsLib.recordNamePlural;
if (numRows == 1)
name = MapsLib.recordName;
$( "#result_box" ).fadeOut(function() {
$( "#result_count" ).html(MapsLib.addCommas(numRows) + " " + name + " gevonden");
});
$( "#result_box" ).fadeIn();
},
getList: function(whereClause) {
var selectColumns = "Achternaam, Adres, Postcode, Woonplaats";
MapsLib.query(selectColumns, whereClause, "MapsLib.displayList");
},
displayList: function(json) {
MapsLib.handleError(json);
var data = json["rows"];
var template = "";
var results = $("#results_list");
results.hide().empty(); //hide the existing list and empty it out first
if (data == null) {
//clear results list
results.append("<li><span class='lead'>No results found</span></li>");
}
else {
for (var row in data) {
template = "\
<div class='row-fluid item-list'>\
<div class='span12'>\
<strong>" + data[row][0] + "</strong>\
<br />\
" + data[row][1] + "\
<br />\
" + data[row][2] + "\
<br />\
" + data[row][3] + "\
</div>\
</div>"
results.append(template);
}
}
results.fadeIn();
},