Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Suhrit on Aug 05, 2009 09:31
open dhtmlx forum
subgrid problem

Hi, I am trying to create a subgrid in a grid which is loaded with loadXML() method. But I am not seeing the plus image to open the subgrid. It does appear when we use the grid.addRow() method.

Below is the script:

<div id="gridbox" style='width: 100%; height: 150px;'></div>
<script type="text/javascript">
grid = new dhtmlXGridObject('gridbox');
grid.setImagePath("../DHTMLX/dhtmlxGrid/codebase/imgs/");
grid.setHeader(",,Delete,Edit,Lock,HUD Section,HUD Section Desc,HUD Line,Description,Amount,#master_checkbox,Notes");
     grid.setInitWidths("50,50,50,50,40,50,65,65,205,80,50,50");
grid.setColTypes("sub_row_grid,img,img,img,img,ro,ro,ro,link,price,ch,img");
grid.setSkin("rflx");
grid.enableAutoHeight(true);
grid.init();
grid.loadXML("../xml/sgrid.xml");

grid.attachEvent("onSubGridCreated",function(subgrid,row_id,cell_index){

subgrid.setHeader("E,F,G");
subgrid.setColAlign("left,left,right");
subgrid.enableResizing("false,false,false");
subgrid.setColHidden("false,false,false");
subgrid.setInitWidthsP("*,35,15");
subgrid.setColTypes("ro,ro,ro");
subgrid.setSkin("blue");
subgrid.enableAutoHeight(true);
subgrid.init();
subgrid.addRow(row_id,'a,b,c');

return false;
});
</script>


Below is a row from the xml I am trying to load:

<?xml version="1.0"?>
<rows>
    <row id="1">        
        <cell></cell>
        <cell>../imgs/leaf.gif^Add Payment^javascript:showFeeManagement()^_self</cell>
        <cell>../imgs/delete.gif^Delete Fee^javascript:deleteFee(1)^_self</cell>
        <cell>../imgs/edit.gif^Edit Fee^javascript:showFeeManagement()^_self</cell>
        <cell>../imgs/lock.png^Lock Fee</cell>
        <cell>800</cell>
        <cell>Items Payable in Connection with Loan</cell>
        <cell>801</cell>
        <cell>Origination Fee</cell>
        <cell>1000.00</cell>
        <cell/>
        <cell>../imgs/notesEmpty.GIF^Show Fee History</cell>
    </row>
</rows>
Answer posted by dhxSupport on Aug 06, 2009 01:11
If cell has "sub_row" or "sub_row_grid" type it's value shold be any but no empty:
<?xml version="1.0"?> 
<rows> 
  <row id="1">  
  <cell>some</cell>
or 
grid.setColTypes("sub_row_grid[1],img,img,img,img,ro,ro,ro,link,price,ch,img");