| Sample: dhtmlxGrid | Change Grid's parent object | dhtmlxGrid main page |

You can use attachToObject method to move grid from one place to another switching its parents

    <script>
            mygrid = new dhtmlXGridObject('gridbox');
            ...
            mygrid.init();
            mygrid.loadXML("../grid.xml");

            //switch parent to new one
            function moveTo(objId){

                mygrid.attachToObject(document.getElementById(objId))
            }</script>

Parameters passed to the constructor are:
- object to attach grid to (should be loaded before calling constructor)
Specify additional parameters of the grid:
- imgURL - specifies the path to the folder with grid imgs
- setHeader("Column A, Column B") - set column header labels
- setInitWidths("100,150") - set column width in pixels
- setColTypes("ro,ed") - set column types (with editor codes. See documentation for details)
- setColAlign("right,left") - set column text align
- setColSorting("int,str") - set column sorting type
- enableMultiselect(true) - enables multiselection support
- loadXML("grid.xml") - load grid data from XML