Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jesus Gonzalez on Sep 09, 2009 08:55
open dhtmlx forum
Subgrid

Hi,
I use a grid where each row contains a subgrid. These rows are not expanded (+). My problem is that when trying to access data in each row subgrid by "gridRecursos.cells (1.0). getSubGrid (). getCheckedRows (0)", it says that the object does not exist. This situation does not occur if the row is expanded (-). How can I solve this problem?
Thanks for your support!!

Source code for the creation of the grid and subgrid:
....
var gridRecursos;
gridRecursos = new dhtmlXGridObject('datagrid');
gridRecursos.setImagePath("scripts/dhtmlxGrid/codebase/imgs/");
gridRecursos.setSkin("light");
gridRecursos.setColumnHidden(2, true);
gridRecursos.enableTooltips("false");
gridRecursos.loadXML("data/getPlanificarVehiculos.php?idioma=<?php echo $idioma; ?>&login=<?php echo $login; ?>");
gridRecursos.attachHeader("#rspan,#text_filter,#rspan,#select_filter");

gridRecursos.attachEvent("onSubGridCreated",function(subgrid,row_id,cell_index)
{
subgrid.setImagePath("scripts/dhtmlxGrid/codebase/imgs/");
subgrid.enableTooltips("false");

subgrid.attachEvent("onXLE",function(){
subgrid.callEvent("onGridReconstructed",[])
})

subgrid.loadXML("data/getPlanificarTurnosVehiculo.php?idioma=<?php echo $idioma; ?>&login=<?php echo $login; ?>&id=" + row_id);
subgrid.attachHeader("#rspan,#rspan,#rspan,#rspan,<?php echo $i18n['horaInicio']; ?>,<?php echo $i18n['horaFin']; ?>,<?php echo $i18n['minutos']; ?>,<?php echo $i18n['horaInicio']; ?>,<?php echo $i18n['horaFin']; ?>,<?php echo $i18n['minutos']; ?>,<?php echo $i18n['horaInicio']; ?>,<?php echo $i18n['horaFin']; ?>,<?php echo $i18n['minutos']; ?>");
}
....


Regards,
Jesus.
Answer posted by dhxSupport on Sep 09, 2009 09:02
Sub grid object creates only after first open. If you haven't opened sub row sub grid object is not available. 
You can try to use dhtmlxTreeGrid extension. It has more extended parent-child functionality. Please find more information here http://dhtmlx.com/docs/products/dhtmlxTreeGrid/index.shtml