Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andy on Jul 08, 2009 11:51
open dhtmlx forum
Grid with subgrid

Is there a way to load a subgrid dynamically? My upcomgin web project will be developed using asp.net. I am thinking of buying your pro. version of dhtmlxGrid to utilize Grid with subgrid feature. I searched around, but couldn't find a sample or doc that answer my question.

In Grid Configuration XML, can I do something like the following in order to load a subgrid dynamically?

...
<row id="1">
<cell type='sub_grid_row'>subgrid.aspx?ROWID=1</cell>
</row>
...


If the above method doesn't work, can I call a asp page in "onSubGridCreated" event like the following?

mygrid.attachEvent("onSubGridCreated",function(sub,id,ind,value){
sub.loadXMLString("subgrid.aspx?ROWID=" + id);
//or mygrid.load("subgrid.aspx?ROWID=" + id);
return false;
});
Answer posted by dhxSupport on Jul 09, 2009 01:40
Grid provides onSubGridCreated event which can be used to customize sub-grid loading 

grid.attachEvent("onSubGridCreated",function(sub,id,ind,value){
  //sub - subgrid object
  //value - value from XML for related cell
  sub.loadXMLString(any necessary xml string)
  //or mygrid.load("grid.xml”);
  return false; //block default logic });

If you have a lot of row at the sub grid and wish increase loading perfomance better to use dhtmlxTreeGrid extension which has more advanced parent-child functionality. Please see example here http://dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/initialization_loading/treeGrid_dynamic.html

Answer posted by Andy on Jul 09, 2009 09:56
Thanks for the reply. Could you show me exactly how I would call an ASP web page inside the onSubGridCreated event? 
Answer posted by dhxSupport on Jul 10, 2009 01:02
To load sub grid you can use any availible loading types.
grid.attachEvent("onSubGridCreated",function(sub,id,ind,value){
  sub.loadXMLString("subgrid.aspx?ROWID=" + id);
  return false; //block default logic });

Answer posted by Andy on Jul 10, 2009 04:24
Thanks so much! I had to make sure there's a way to make it work before I buy it.