Is there a way to set the toggle to hide the grid on open?

Question:

Is there any way to set the toggle to hide the grid on open - the user would click to open instead of open being the default?

Answer:


To have DataGrid toggle off on page load you need to add a few lines of code on your page as follows:

In the document head tag add:

<style title="hideonload">
<!--
#container div.flexigrid {
height: 26px !important;
}
-->
</style>

where #container is the id of the container of the grid. It can be a table cell(td), or div tag. Also you need to give the style tag a title parameter so it can be called by a JS function, which follows.

Just before the closing body tag place the following JS code:

<script>
<!--
$(function() {
$($('#dmx_grid2').get(0).grid.gDiv).addClass('hideBody');
$('style[title="hideonload"]').remove();
});
-->
</script>

You must replace grid id with your DataGrid ID. That function removes the style. 

If you want to have more than one grid on the page you can do it by adding in that same style tag

#container2 div.flexigrid {
height: 26px !important;

and in the script tag at the end of the body tag :

$($('#dmx_grid2,#dmx_grid3')