Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dale M on Mar 26, 2008 09:26
open dhtmlx forum
Using dhtmlxGrid, how can I expand a sub_row_ajax cell automatically?

I am using loadxml to populate the dhtmlxGrid Professional. I would like to auto-expand some of the sub_row_ajax cells. How can this be done?

Here is an example row:

<row id="231">
<cell>Hitch A Ride</cell>
<cell type="sub_row_ajax">media.php?song_id=231</cell>
<cell>Boston</cell>
<cell>Master</cell>
<cell>19</cell>
<cell>2008-03-25</cell>
</row>

Is there an attribute I could put in the <cell> with sub_row_ajax? I tried:

<cell open="1" type="sub_row_ajax">media.php?song_id=231</cell>
<cell expand="1" type="sub_row_ajax">media.php?song_id=231</cell>

but neither of those methods worked.

Thanks!
Answer posted by Support on Mar 26, 2008 11:21
There is no built in support for such functionality.
Node can be opened by js API as
    grid.cells(i,j).open();
but there is no way to do such task from XML.

Basically something similar can be achieved with some extra code

grid.loadXML(url,function(){
    //custom onload code
    var cells=grid.xmlLoader.doXPath("//cell@open"); //search for cells with open attribute
    for (var i=0; i<cells.length; i++){
          var id=cells[i].parentNode.getAttribute("id");
          var index = 0; // basically can be taken from XML as well, but it is a few lines of code, if you know in which column sub_rows expected - just set necessary column index
          grid.cells(id,index).open();
    }
   
});