Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by TonyW on Mar 25, 2008 17:38
open dhtmlx forum
Grid with sub grid

Thanks for your response regarding instatiation of the sub-grid and the retrieval of the object reference - would it be possible to provide a sample on site. It would appear that the row containing the sub_grid needs to be selected in order for the solution to work. How do you ensure that the row is selected when the expand|collapse image is clicked?

The solution is key to a decision to purchase the PRO version for a current project.

Regards

TonyW

Answer posted by Support on Mar 26, 2008 03:26
The problem with detection of grid initialization was fixed in updated version of sub_grid excell ( which included in latest build )
Now there are two additional events

a) onSubGridCreated
Called when sub grid object created ( trigered by sub_row opening ), bug before data from related XML file loaded

b) onSubGridLoaded
Called when sub grid loaded configuration XML and parsed its values


Events can be used to change grid behavior
grid.attachEvent("onSubGridCreated",function(subgrid){
    subgrid.enableMultiselect(true);
    subgrid.enableEditEvents(false,false,false);
    return true; // mandatory!
})
Add|preselect some data after configuraton loading
grid.attachEvent("onSubGridLoaded",function(subgrid){
    subgrid.addRow(someid,value);
    subgid.selectCell(someid,0);
 })
Events can be used to fully change the way how subgrid loaded, for example it can be built manually
grid.attachEvent("onSubGridCreated",function(subgrid){
    subgrid.setHeader("A,B,C");
     subgrid.setColTypes("ro,ro,ro");
    subgrid.setInitWidths("100,100,100")
    subgrid.init();
    return false;  // block default behavior
 })
Or loaded from XML string
grid.attachEvent("onSubGridCreated",function(subgrid,id,ind,data){
    subgrid.loadXMLString(data); // use current data as configuration xml
    return false; // prevent default behavior
 })

Please contact us directly at support@dhtmlx.com if you still need sample of usage.
Attachments (1)