Reputation: 136
The following javascript code is not working which has a query to google fusion table.
$('#map_canvas').gmap({ 'center': new google.maps.LatLng(37.447038,-122.160575), 'zoom': 11, 'mapTypeId' : google.maps.MapTypeId.ROADMAP, 'callback': function(map) {
$('#map_canvas').gmap('loadFusion', { 'query': {
'from': '297050' ,
'orderBy': ST_DISTANCE('Address', LATLNG(37.447038,-122.160575)),
'limit':10 } });
var t = setTimeout(function() {$('#dialog').dialog('close');}, 2000);
}
});
If I remove the query line having the orderby clause (as below) it works fine
$('#map_canvas').gmap({ 'center': new google.maps.LatLng(37.447038,-122.160575), 'zoom': 11, 'mapTypeId' : google.maps.MapTypeId.ROADMAP, 'callback': function(map) {
$('#map_canvas').gmap('loadFusion', { 'query': {
'from': '297050' ,
'limit':10 } });
var t = setTimeout(function() {$('#dialog').dialog('close');}, 2000);
}
});
Please Advise hot to fix this query
Upvotes: 0
Views: 362
Reputation: 161334
The "orderBy" property seems to work as a string. Instead of:
'from': '297050' ,
'orderBy': ST_DISTANCE('Address', LATLNG(37.447038,-122.160575)),
'limit':10 } });
Try (notice the double quotes (") around the orderBy property:
query: {
select: 'Address',
from: 297050,
orderBy: "ST_DISTANCE('Address', LATLNG(37.447038,-122.160575))",
limit:5
},
Upvotes: 2