Need help: sorting elements combo box in ArcGIS Java script API

798
4
11-26-2012 10:22 PM
SunilPalkar
Occasional Contributor
Hello All
I am using sorting elements in combo box in ArcGIS Java Script API (v.2.8) & for sorting I am using
??? fetchProperties="{sort:[{attribute:'name', descending:false}]}" .

All entries in combo box are sorting excluding ???ALL??? entry.

So I am not able to understand that why ???ALL??? is not sorting ascending. It is displaying at the end but when make ???descending: true??? then its displaying first.

I want to put ???ALL??? in the beginning of the combo-box. Therefore, any help will be great..
0 Kudos
4 Replies
__Rich_
Occasional Contributor III
Posting the code, rather than pictures of the results, would probably be more useful...
0 Kudos
SunilPalkar
Occasional Contributor
//combo box item
  function populateList(results) {
    //Populate the dropdown list box with unique values
    //alert("sss:  "+results.length);
    var zone;
    var values = [];
    var testVals={};

    //Add option to display all zoning types to the dropdown list 
    //values.push({name:"ALL"})

    var features = results.features;
    //values.push({name:'ALL'});
    dojo.forEach (features, function(feature) {
      zone = feature.attributes.TOPIC;

      if (!testVals[zone]) {
        testVals[zone] = true;
        values.push({name:zone});

      }
    });

    var dataItems = {
           identifier: 'name',
           label: 'name',
           items: values
    };
    var store = new dojo.data.ItemFileReadStore({data:dataItems});
    dijit.byId("mySelect").store = store;
    values.push({name:"ALL"})
  }
0 Kudos
__Rich_
Occasional Contributor III
 tags please!

//combo box item
function populateList(results) {
    //Populate the dropdown list box with unique values
    //alert("sss: "+results.length);
    var zone;
    var values = [];
    var testVals={};

    //Add option to display all zoning types to the dropdown list 
    //values.push({name:"ALL"})

    var features = results.features;
    //values.push({name:'ALL'});
    dojo.forEach (features, function(feature) {
        zone = feature.attributes.TOPIC;

        if (!testVals[zone]) {
            testVals[zone] = true;
            values.push({name:zone});

        }
    });

    var dataItems = {
        identifier: 'name',
        label: 'name',
        items: values
    };
    var store = new dojo.data.ItemFileReadStore({data:dataItems});
    dijit.byId("mySelect").store = store;
    values.push({name:"ALL"})
}
0 Kudos
SunilPalkar
Occasional Contributor
Sorry geos_rfleet Sir..
geos_rfleet;252202 wrote:
 tags please!
0 Kudos