Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sanju Thomas on Jun 04, 2009 05:30
open dhtmlx forum
using sub_row_grid

Hi, I am trying to use sub_row_grid in grid. The example given in the documentation is not talking about the xml for the sub_row_grid.

I have issues when I try to load the sub_row_grid.

code
-----
<link rel="STYLESHEET" type="text/css" href="js/dhtmlxTreePro/js/grid/dhtmlxgrid.css">


<script src="js/dhtmlxTreePro/js/dhtmlxcommon.js"></script>
<script src="js/dhtmlxTreePro/js/grid/dhtmlxgrid.js"></script>        
<script src="js/dhtmlxTreePro/js/grid/dhtmlxgridcell.js"></script>
<script src="js/dhtmlxTreePro/js/grid/dhtmlxtreegrid.js"></script>
<script src="js/dhtmlxTreePro/js/dhtmlxtree_er.js"></script>
<script src="js/dhtmlxTreePro/js/grid/excells/dhtmlxgrid_excell_sub_row.js"></script>

    
<div id="mygrid_container" style="width:722px;height:250px;"></div>



<body onload="doInitGrid();">


<script>

var mygrid;

function doInitGrid()
{

mygrid = new dhtmlXGridObject('mygrid_container');

mygrid.setImagePath("js/dhtmlxTreePro/imgs/");

mygrid.setHeader("Period,Location,High,Medium,Low");



mygrid.setInitWidths("144,144,144,144,144");

mygrid.setColAlign("left,middle,middle,middle");

mygrid.setColTypes("er,sub_row,er,er,er");

mygrid.enableTooltips("false,false,false,false");

mygrid.setSkin("light");


mygrid.init();

mygrid.loadXML("dashboard.xml");


}


</script>


xml for main grid
--------------------

<?xml version="1.0" encoding="UTF-8"?>
<rows>

    <row id="L30_DAYS">
        <cell>Last 30 days</cell>
        <cell type="sub_row_grid">dashboard1.xml</cell>
        <cell> 5 </cell>
        <cell> 2 </cell>
        <cell> 2 </cell>
    </row>

    <row id="CUR_FY">
        <cell>FY 2009</cell>
        <cell> </cell>
        <cell>2</cell>
        <cell>4</cell>
        <cell>7</cell>
    </row>

    <row id="PREV_FY">
        <cell>FY 2008</cell>
        <cell> </cell>
        <cell>2</cell>
        <cell>5</cell>
        <cell>17</cell>
    </row>

    <row id="BEFORE_PREV_FY">
        <cell>Pre-FY 2008</cell>
        <cell> </cell>
        <cell>11</cell>
        <cell>20</cell>
        <cell>28</cell>
    </row>

</rows>

xml for sub_grid
-------------------


<?xml version="1.0" encoding="UTF-8"?>
<rows>

    <row id="L30_DAYS">        
        
        <cell> 5 </cell>
        <cell> 2 </cell>
        <cell> 2 </cell>
    </row>

    <row id="CUR_FY">
        <cell>2</cell>
        <cell>4</cell>
        <cell>7</cell>
    </row>

    <row id="PREV_FY">
        <cell>2</cell>
        <cell>5</cell>
        <cell>17</cell>
    </row>

    <row id="BEFORE_PREV_FY">
        <cell>11</cell>
        <cell>20</cell>
        <cell>28</cell>
    </row>

</rows>


Could you please check if there are any issues with xml ?
Answer posted by dhxSupport on Jun 04, 2009 05:57
xml for sub_grid should contain <head> part to set sub grid configuration:
<?xml version="1.0" encoding="UTF-8"?> 
<rows>
<head>
<column type="type" width="144" sort="int">One</column>
....
</head>
</rows>

More information about grid's xml structure you can find here http://www.dhtmlx.com/docs/products/docsExplorer/doc/dhtmlxxml/index.html#dhtmlx_xml

Answer posted by Sanju Thomas on Jun 04, 2009 07:25
Thanks a lot, it works.