Hi all,
I am trying to use the JQuery auto-complete widget with my widget. My goal is to create an input text box where users can enter a county (that would auto-complete) then, when the auto-completed county value is entered have a function that would allow users to extract data by the selected county extent.
here is what I have so far.
I would select features values for the auto-complete input box as such:
I get a 404 error when trying to achieve this first task.
error:
POST http://localhost:58479/layout-master/demos/[object%20Object] 404 (Not Found) jquery.min.js:4send jquery.min.js:4m.extend.ajax jquery.min.js:4m.(anonymous function) jquery.min.js:4$.autocomplete.source Map-Widget-Panel-carousel-BasemapList-Legend-%20Tool.html:484e.widget._search jquery-ui.min.js:7(anonymous function) jquery-ui.min.js:6e.widget.search jquery-ui.min.js:7(anonymous function) jquery-ui.min.js:6(anonymous function)
//build query task
var queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3");
//create an array
var aStateNames = [];
//build query filter
var query = new Query();
query.returnGeometry = false;
query.outFields = ["STATE_NAME"];
query.where = "OBJECTID > 0";
queryTask.execute(query, function (results) {
//parse results and add to autocomplete widget
dojo.forEach(results.features, function (value, index) {
aStateNames.push(value.attributes.STATE_NAME);
});
}, function (error) {
alert("Error: " + error);
});
$("#states").autocomplete({
source: aStateNames
});
and then extract by the selected value:
var queryTask = new QueryTask("http://webgisdevint1/arcgis/rest/services/Alex_Try/Counties/MapServer/0");
queryTask.on("complete", addToMap)
var query = new Query();
query.returnGeometry = true;
query.outFields = ["STATE_NAME"];
query.where = "STATE_NAME = '" + aStateNames+ "'";
query.outSpatialReference = map.spatialReference;
queryTask.execute(query, function (featureSet) {
var AOI = featureSet.features[0].geometry;
var graphic = new Graphic(AOI, symbol);
var features = [];
features.push(graphic);
var fSet = new FeatureSet();
fSet.features = features;
How can I have the auto-complete widget work and then hook it up to the extract function?
Any idea, help is welcome!