AnsweredAssumed Answered

Search tool giving me a random error

Question asked by alex.gole_ELDORADOCOUNTY on Jun 28, 2017
Latest reply on Jun 29, 2017 by csgeosol1

Hi all,

I am using a template from GitHub(ESRI) and it seems like the search tool is giving me a random error after i click on the suggestion:

 

line 598: 

Code:

var projectid = result.results[result.numResults][0].feature.attributes.PROJECT_ID;

 

 

 

All the code

Code:

 on(this._geocoder, 'search-results', lang.hitch(this, function (result) {  
       
            if(result){
                    var projectid = result.results[result.numResults][0].feature.attributes.PROJECT_ID;
                    //result.results[result.numResults][0].feature.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]), 2), new Color([255, 255, 0, 0.25]))
                    //console.log(result.results[result.numResults][0].feature);
                    window.history.pushState(projectid, null, "?projectid=" + projectid);
                    saveState.push(result.results[result.numResults][0].feature.attributes.PROJECT_ID);
              
                    this._selectProject(projectid);
                    var graphicExt = result.results[result.numResults][0].feature.geometry.getExtent();
                            //console.log(graphicExt);
                    mapobject.infoWindow.pagingInfo = true; 
                    mapobject.infoWindow.pagingControls = true;
                    mapobject.infoWindow.titleInBody = true;
           
                    //mapobject.infoWindow.setTitle(result.results[result.numResults][0].feature.attributes.Description);
                    mapobject.infoWindow.setContent("<div style='font-size: 12px;line-height: 16px;font-weight: bold;'>"+result.results[result.numResults][0].feature.attributes.Description +"</div><div style='border-top: 1px solid #eee;margin-top: 6px;margin-bottom: 6px'></div>" +
                            "<table><tr><td style='padding-right: 5px;color: #888888;'>Project </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.PROJECT_ID + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>Project Name </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.Description + "</td></tr>"+
                            "<tr><td style='padding-right: 5px;color: #888888;'>Project Details </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.PublicProjDesc + "</td></tr>"+
                            "<tr><td style='padding-right: 5px;color: #888888;'>Project Manager</td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.ProjMgrName + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>Project Cost ($) </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.ProjectCost + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>Supervisor Districts </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.SuperDistricts + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>TIM Zones </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.TIMZones + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>Funding Sources </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.FundSources + "</td></tr>" +
                            "<tr><td style='padding-right: 5px;color: #888888;'>Construction Start </td><td style='padding-right: 5px;color: #333;'>" + result.results[result.numResults][0].feature.attributes.ConstrStartFY + "</td></tr></table>"
                        );

                    mapobject.infoWindow.show(graphicExt.getCenter());
                    mapobject.setExtent(graphicExt.expand(2));
                }

        }));

Outcomes