AnsweredAssumed Answered

Datagrid zoom to point infoWindow is blank

Question asked by jbrink on Jan 12, 2012
Latest reply on Jan 13, 2012 by jbrink
When I click on a row in my datagrid it zooms the map and the infowindow box pops up, but the attributes don't display.

How do I get the results to display in the infowindow?

Thanks

Jimmy Brink

This part of my application based off of the Find Results in DataGrid sample.


Code from the onRowClickHandler below:

function onRowClickHandler(evt) {
            // points don't have a getExtent() method...
            // if selectedWarrant is a point, center the map on it
            var clickedWarrantID = grid.getItem(evt.rowIndex).OBJECTID;
            var selectedWarrant;
            var level = 11;


            dojo.forEach(map.graphics.graphics, function (graphic) {
                if ((graphic.attributes) && graphic.attributes.OBJECTID === clickedWarrantID) {
                    selectedWarrant = graphic;
                    map.infoWindow.setContent(graphic.getContent());

                    return;
                }
            });
            if (selectedWarrant.geometry.declaredClass == 'esri.geometry.Point') {
                map.centerAndZoom(selectedWarrant.geometry, map.setLevel(level));

                var sp = map.toScreen(selectedWarrant.geometry);
                //map.infoWindow.setContent(graphic.getContent());
               map.infoWindow.show(selectedWarrant.geometry, map.getInfoWindowAnchor(sp));
            } else {
                var WarrantExtent = selectedWarrant.geometry.getExtent();
                var screenpoint = map.toScreen(selectedWarrant.geometry.getExtent().getCenter());
                var mappoint = map.toMap(screenpoint);
                map.centerAt(mappoint);
                map.centerAndZoom(sp, level);
                map.infoWindow.show(WarrantExtent.getCenter(), map.getInfoWindowAnchor(screenpoint));
            }
        }

Outcomes