schlot

problems with dojox.mobile components - mobile parser?

Discussion created by schlot on Nov 15, 2012
I am programmtically adding a mobile button and ListItem to a mobile view, following the example in the find Nearby sample.  This works fine in Firefox.  When I try it in IE 8, it doesn't.  I am using the components dojox.mobile.Button and dojox.mobile.ListItem.

I'm wondering if I don't have everything I need in my dojo.require statements or if not calling the mobile parser correctly?  It also seemed like I have to add a dojo.require statement for the mobile button, but that maybe it was or wasn't needed depending on what version of the compact build I was using?

dojo.require("dojox.mobile.Button");


My compact build version is 3.2
     <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2compact"></script> 


Are there just too many things about the dojox.mobile components that are going to make it impossible to get my code working in IE8?  Here's the section of code that seems to be failing. When debuggin in IE8 and adding break points, I can see listItems getting created and added to the itemList as it steps through the selected features.  But at the end, when my search results view is displayed, it is empty!  I thought maybe the problem was isolated to just the mobile button, but when I commented out the lines dealing with it, it didn't help. 
                dojo.connect(featureLayer, "onSelectionComplete", function(features){
                    itemList = dijit.byId('searchResults');  //changed this to be global 11/9/12
                    //Remove any existing items from the result window
                    while (itemList.domNode.hasChildNodes()) {//may want to move this sooner, user can see the old list for a moment
                        itemList.domNode.removeChild(itemList.domNode.lastChild);
                    }
                    //If no results are found users should increase search distance
                    if(features.length === 0){
                            var noResults = new dojox.mobile.ListItem({
                            label: "No Results"
                        });
                        noResults.set("class", "mblVariableHeight");
                        noResults.domNode.innerHTML = "No results found.  Try a larger search distance using the settings option.";
                        itemList.addChild(noResults);
                      //  return;
                    }
                    //modifies the returned distance to something more user friendly
                    dojo.forEach(features, function (feature) {
                        feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
                    });
                    
                    //sorts the returned features so closest features are at the top
                    var sortedFeatures = features.sort(function(a, b){
                        return a.distance - b.distance;
                    });
        
                    dojo.forEach(sortedFeatures, function (result) {       
                        var resultItem = new dojox.mobile.ListItem({ label: result.attributes.FACILITY });
                        resultItem.set("class", "mblVariableHeight");
                        var content = [];
                        content.push(result.attributes.FACILITY + "<br />" + result.attributes.ADDRESS + "<br />" );                    
                        content.push(result.distance + " miles<br/>");
                        var formatContent = content.join("");        
                        resultItem.domNode.innerHTML = formatContent;
                        var button = new dojox.mobile.Button({
                            label: 'Map It',
                            moveTo: 'mapView'
                        }).placeAt(resultItem.domNode);
        
                        var locationDetails = function (result) {
                             return function (results) {  //(sortedFeatures);   ??                   
                                mapResults(results, result); //mapResults(sortedFeatures,result);??
                            };
                        };

                      //  dojo.connect(button, "onClick", locationDetails(result));
                        //clearProgress();
                                itemList.addChild(resultItem);
                    });
                    clearProgress();
                    //
                });

Outcomes