You may want to have the datagrid inside a FloatingPane,Thanks Rama. Your second solution does hide the grid table, but I would also like to hide the entire contentPane (this a div tag in the html section), in which the datagrid resides, and have the map resize to shrink/grow, based on the search button selection.
http://dojotoolkit.org/reference-guide/1.7/dojox/layout/FloatingPane.html
And you can always make any element hidden/visible,
Ex: dojo.byId('grid').style.visibility = 'visible';
esri.hide(MyContentPane);then appears by inserting
esri.show(MyContentPane);after the "on-click" event, and again hides when selecting the row source in the datagrid.
map.resize(map)This (above) snippet does the job of resizing the map (center pane) after hiding the contentPane, but does not load the map data. Or, is there a better way to accomplish this?
function collapseList() { dojo.byId("rightPane").style.display = 'none'; dojo.style(dojo.byId("mapDiv"), "width", "100%"); dijit.byId("mapDiv").resize(); map.resize(); map.reposition();}
esri.hide(datagrid); dojo.style(dojo.byId("map"), "height", "93%");Then, upon a click of a Search button, I have it do just the opposite of the code above, displaying the datagrid and resizing the map again.
esri.show(datagrid); dojo.style(dojo.byId("map"), "height", "77%");Then, after the user selects a row source in the datagrid I have it simply repeat "Code 1", above.
function showResults(results) { //This function works with an array of FindResult that the task returns map.graphics.clear(); var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5])); //Create Extent to use for view an area containing all the search results var SearchAreaExtent; //create array of attributes var items = dojo.map(results,function(result){ var graphic = result.feature; graphic.setSymbol(symbol); map.graphics.add(graphic); //Add Extent to Search Area Extent if (SearchAreaExtent) SearchAreaExtent = SearchAreaExtent.union(graphic.geometry.getExtent()); else SearchAreaExtent = graphic.geometry.getExtent(); return result.feature.attributes; });, but it currently doesn't recognize the map extent following resize of the map and datagrid with:
dojo.style(dojo.byId("map"), "height", "75%");Is it possible to use 'onExtentChange' function on resizing the map as such?