Friends
jsFiddle link above is simple but I cannot get any field to populate other than OBJECTID.
Initially trying to return distinct values from map service, which works in the REST interface, but not for me in code.
Any suggestions welcome.
Thanks
Keith
Solved! Go to Solution.
The code in this sample a little old, as I think ItemFileReadStore is deprecated, but I was able to get it to work by removing the "identifier" in your data. I think the "identifier" has to a numeric field... I think.
This worked for me
var query = new esri.tasks.Query(); query.where = "1=1"; query.returnGeometry = false; query.returnDistinctValues = true; query.outfields = ["FIELD_NAME"]; //query.orderByFields = ["FIELD_NAME"]; // only works in 10.1 services, this one is 10.01 getList.queryFeatures(query, function (featureSet) { //Populate dropdown list var values = dojo.map(featureSet.features, function (feature) { return { name: feature.attributes.FIELD_NAME }; }); var dataItems = { label: 'name', items: values }; var store = new dojo.data.ItemFileReadStore({ data: dataItems }); ...
That populated the dropdown with the field names.
Here is the docs on Combox with samples using the dojo/store to populate the dropdown.
The code in this sample a little old, as I think ItemFileReadStore is deprecated, but I was able to get it to work by removing the "identifier" in your data. I think the "identifier" has to a numeric field... I think.
This worked for me
var query = new esri.tasks.Query(); query.where = "1=1"; query.returnGeometry = false; query.returnDistinctValues = true; query.outfields = ["FIELD_NAME"]; //query.orderByFields = ["FIELD_NAME"]; // only works in 10.1 services, this one is 10.01 getList.queryFeatures(query, function (featureSet) { //Populate dropdown list var values = dojo.map(featureSet.features, function (feature) { return { name: feature.attributes.FIELD_NAME }; }); var dataItems = { label: 'name', items: values }; var store = new dojo.data.ItemFileReadStore({ data: dataItems }); ...
That populated the dropdown with the field names.
Here is the docs on Combox with samples using the dojo/store to populate the dropdown.
Thank you again Rene.
It worked.
I will work to change the store.
Keith