3

I would like to upgrade a web app I am working on from v2.1 to v3.1 of the Javascript API (I have tried 3.2 but I am getting some very odd rending problems, so I'm settling with 3.1 for now...) One issue I have encountered is that a ComboBox populated with a store does not seem to fully function with 3.1. I was told I can fix this by replacing the ComboBox with a FIlteringSelect widget, but so far I haven't succeeded. Below is my code. I was hoping I wouldn't need to do much more than replace the ComboBox object with the FilteringSelect object, but that apparently isn't sufficient. Can somebody help me see what I am missing? Thanks, Jason

JS (old code:)

      function populateSchoolMenu(results) 
{
    var schoolName;
    var values = [];
    var testVals = {};

    var features = results.features;
    dojo.forEach(features, function (feature) {
        if ( (schoolLayerFlag == 0) || (schoolLayerFlag == 2) )
        {
            schoolName = feature.attributes.Name;

        }
        else if (schoolLayerFlag == 1)
        {
            schoolName = feature.attributes.Site_name;

        }


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

    var dataItems = {
        identifier: 'name',
        label: 'name',
        items: values
    };
  var menuStore = new dojo.data.ItemFileReadStore({ data: dataItems });

  dijit.byId("schoolMenu").store = menuStore;
   }

HTML (old:)

            <select id = "schoolMenu"
            dojotype="dijit.form.ComboBox"
            value = "Select School"
            autoComplete="true" class="comboBoxClass"
            forceValidOption="false"


            onchange="executeSelectedQuery(this)">
            </select> 
2
  • Please post the code that associates your store with your ComboBox. If you were previously using schoolMenu.store = menuStore, you need to use schoolMenu.set("store", menuStore) instead. Oct 15, 2012 at 22:42
  • Hi, I think I added my comment below right before you did, with the same information...the code is you ask for is given above...Thanks for the feedback!
    – JasonBK
    Oct 16, 2012 at 12:20

1 Answer 1

1

Your rendering problems with 3.2 are most likely due to ESRIs new requirement that you add a new css file to your code:

 <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" />
5
  • thank you, that seems correct...but I am still having the problem with the FilteringSelect dropdown menu...I basically just tried replacing ComboBox with FilteringSelect in the code above (and changing the API)...Currently I get this error: "TypeError: _2d.store.query is not a function" referencing serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dijit/form/… Line 2
    – JasonBK
    Oct 15, 2012 at 20:42
  • I did make some progress, by replacing this line : dijit.byId("schoolMenu").store = menuStore; with this: dijit.byId("schoolMenu").set ("store", menuStore); ..... but now I am getting other errors ("Error: Unable to complete operation.", line 34 3.2 API)..I'll keep working at it!
    – JasonBK
    Oct 15, 2012 at 21:13
  • Is your combo box working after using set() to specify the store? Oct 16, 2012 at 14:04
  • @Craig esri.css does not affect how Dojo dijits are rendered but does impact how the map and widgets provided by Esri (includes the map itself, info window, popup, legend, bookmarks widget, etc.) look. Since we're talking about dijit.form.ComboBox, missing esri.css is not likely to be the source of the problem. Oct 16, 2012 at 14:09
  • the Filtering Select drop down is working more or less...I am getting some different errors as noted above; I was previously clearing the ComboBox with a .reset call, but I am now getting some errors when using the same technique with the Filtering Select. Also, I should explain my original problem a bit more clearly...the problem with the ComboBox when I upgraded the API is that the dropdown menu did not populate with the items from the store...I could type in an item hit return and get a result, but there was no populated list to select from..this now works using FilteringSelect and v3.2
    – JasonBK
    Oct 17, 2012 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.