//Populate the ComboBox with unique values var stateName; var values = []; var testVals = {}; //Add option to display all district names to the ComboBox values.push({ name : "All India" }); //Loop through the QueryTask results and populate an array //with the unique values var features = results.features; dojo.forEach(features, function(feature) { stateName = feature.attributes.State_name; if (!testVals[stateName]) { testVals[stateName] = true; values.push({ name : stateName }); } }); //Create a ItemFileReadStore and use it for the //ComboBox's data source var dataItems = { identifier : 'name', label : 'name', items : values }; var storeS = new dojo.data.ItemFileReadStore({ data : dataItems });
dijit.byId("selStateM2").set("store", storeS);
var sortAttr = [{ attribute : "name", ascending : true }]; storeS.fetch({ query : {}, sort : sortAttr });
Solved! Go to Solution.
searchAttr="<your field name>" fetchProperties="{sort:[{attribute:'<your field name>', descending:false}]}"
<input id="cboCrossStEnd" dojoType="dijit.form.FilteringSelect" checked="checked" searchAttr="CROSSST" name="WidgetName" pageSize="6" fetchProperties="{sort:[{attribute:'CROSSST', descending:false}]}" placeHolder="Select a road from the list" onChange="<your function here>" />
function populateRdNameCbo(results) { //Populate the dropdown list box with unique values values = []; testVals = {}; features = results.features; dojo.forEach (features, function(feature) { curName = feature.attributes.FULLNAME; if (!testVals[curName]) { testVals[curName] = true; values.push({"OBJECTID":feature.attributes.OBJECTID,"RDNAME":feature.attributes.FULLNAME}); } }); dataItems = { identifier: "OBJECTID", label: "RDNAME", items: values }; theStore = new dojo.data.ItemFileReadStore({data:dataItems}); dijit.byId("cboRdName").set("store", theStore); }
searchAttr="<your field name>" fetchProperties="{sort:[{attribute:'<your field name>', descending:false}]}"
<input id="cboCrossStEnd" dojoType="dijit.form.FilteringSelect" checked="checked" searchAttr="CROSSST" name="WidgetName" pageSize="6" fetchProperties="{sort:[{attribute:'CROSSST', descending:false}]}" placeHolder="Select a road from the list" onChange="<your function here>" />
function populateRdNameCbo(results) { //Populate the dropdown list box with unique values values = []; testVals = {}; features = results.features; dojo.forEach (features, function(feature) { curName = feature.attributes.FULLNAME; if (!testVals[curName]) { testVals[curName] = true; values.push({"OBJECTID":feature.attributes.OBJECTID,"RDNAME":feature.attributes.FULLNAME}); } }); dataItems = { identifier: "OBJECTID", label: "RDNAME", items: values }; theStore = new dojo.data.ItemFileReadStore({data:dataItems}); dijit.byId("cboRdName").set("store", theStore); }