Datagrid zoom to point infoWindow is blank

579
2
Jump to solution
01-12-2012 10:17 AM
JimmyBrink
New Contributor II
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));
            }
        }
0 Kudos
1 Solution

Accepted Solutions
JimmyBrink
New Contributor II
Kelly

That worked great.

Thanks

Jimmy Brink

Check out this thread for details on how to retrieve all the attributes from the graphic:

http://forums.arcgis.com/threads/26234-Identify-Results-2.2-getContent?highlight=getContent

View solution in original post

0 Kudos
2 Replies
KellyHutchins
Esri Frequent Contributor
Check out this thread for details on how to retrieve all the attributes from the graphic:

http://forums.arcgis.com/threads/26234-Identify-Results-2.2-getContent?highlight=getContent



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));
            }
        }
0 Kudos
JimmyBrink
New Contributor II
Kelly

That worked great.

Thanks

Jimmy Brink

Check out this thread for details on how to retrieve all the attributes from the graphic:

http://forums.arcgis.com/threads/26234-Identify-Results-2.2-getContent?highlight=getContent
0 Kudos