Hi,
Is it possible to implement autocomplete feature using GeoNames database in edit / add form?
Actually, GeoNames provides a function that will perform the autocomplete using the id of an inputbox.
$(function()
{
function log( message )
{
}
$( "#city" ).autocomplete(
{
source: function( request, response )
{
$.ajax(
{
//url: "http://api.geonames.org/searchJSON",
url: "http://api.geonames.org/searchJSON?&username=yourusername&q=",
dataType: "jsonp",
data:
{
featureClass: "P",
style: "FULL",
maxRows: 12,
name_startsWith: request.term
},
success: function( data )
{
response( $.map( data.geonames, function( item )
{
return {label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,value: item.countryname}
}
)
);
}
}
);
},
}
);
}
);
#city is the id of the inputbox where the autocomplete is implemented
This is doable and i just tested it now.
<script src="http://tompi.github.io/jeoquery/jeoquery.js" type="text/javascript"></script>
Simple include above lib .. and use dataInit property.
$col = array();
$col["title"] = "Name";
$col["name"] = "name";
$col["editable"] = true;
$col["width"] = "40";
$col["editoptions"]["dataInit"] = "function(o){ jQuery(o).jeoCityAutoComplete(); }";
$cols[] = $col;
Hi,
Thanks for your answer, but this is not working for me. It only inhibits the edit option and nothing more… After including the above lib and using dataInit property like in your example the edit is no longer working (the edit form is not showing up).
Is it because I'm using the free version of phpgrid?