AnsweredAssumed Answered

Attribute table Value Binding to Dropdownlist

Question asked by manoharm_UN on Jan 31, 2017
Latest reply on Jan 31, 2017 by manoharm_UN

Hi All,

 

I am getting the value from the attribute table using ArcGIS JS API. I want to list all the values in a particular column.Ex: column called Location is present in the Attribute table and values are present. Now, I want to extract the value of column Location.

Purpose:

Extracted value has to be binded with DropDownlist, So the user can select Location wise. the below function act as datasource to DropdownList

 

Code Tried:


var queryTask = new QueryTask("https://Domain.org/agswa/rest/services/MP_Practise/Deployment/MapServer/0");
var query = new Query();
// query.objectIds = [2]; //HardCode - has to list all locations
query.outFields = ["Location"];
query.returnGeometry = true;
queryTask.on("complete", queryTaskExecuteCompleteHandler);
queryTask.on("error", queryTaskErrorHandler);
queryTask.execute(query, showResults);

function queryTaskExecuteCompleteHandler(queryResults) {
console.log("complete", queryResults);
}

function queryTaskErrorHandler(queryError) {
console.log("error", queryError.error.details);
}

 

Note: If the ObjectId line is uncommented, It extracts single value corresponding to ObjectId.

 

Thanks In Advance

Outcomes