Invoke onExtentChange in code

536
1
Jump to solution
04-25-2013 09:27 AM
Charlesshultz
New Contributor III
Greetings,
I have 3 datagrids that respond to the onExtentChange to fill the grid with data from the map. My issue is when I am on tab1 and zoom to a location tab1 changes the data in the grid1 but I click tab2 to get grid2 data and because I have not moved the map since the first move grid2 will not show data till I pan a little to invoke the onExtentChange. I would like to invoke the onExtentChange in the tab selection change event (which already does some other stuff). I know I could just have all grids refresh anytime the map moves but that would add cost because one of the layers has a fair amount of data. I guess I would also be ok (although not good practice) to just programmically pan the map a few pixels on tab selection change.
Any help would be great...
Thanks,
Chuck
0 Kudos
1 Solution

Accepted Solutions
Charlesshultz
New Contributor III
I solved this by moving the map a tiny bit on tab change... hope it can help someone else down the line.

    dojo.connect(tabs, "_transition", function (newPage, oldPage) {         map.getLayer('tab1').clear();         map.getLayer('tab2').clear();         map.getLayer('tab3').clear();          var Newextent = new esri.geometry.Extent(map.extent.xmin, map.extent.ymin - .01, map.extent.xmax, map.extent.ymax, new esri.SpatialReference({ wkid: 4326 }));         map.setExtent(Newextent);      });

View solution in original post

0 Kudos
1 Reply
Charlesshultz
New Contributor III
I solved this by moving the map a tiny bit on tab change... hope it can help someone else down the line.

    dojo.connect(tabs, "_transition", function (newPage, oldPage) {         map.getLayer('tab1').clear();         map.getLayer('tab2').clear();         map.getLayer('tab3').clear();          var Newextent = new esri.geometry.Extent(map.extent.xmin, map.extent.ymin - .01, map.extent.xmax, map.extent.ymax, new esri.SpatialReference({ wkid: 4326 }));         map.setExtent(Newextent);      });
0 Kudos