Hi,
I need to nest a datagrid of checkboxes generated dynamically within another datagrid. The following is my code:
//jsp
<dmf:panel name="pnlSubTask">
<table width="100%">
<tr>
<td width="52%">
<dmf:datagrid name='parentGrid' cellspacing='1' cellpadding='2' bordersize='0' paged='true' pagesize='5'>
<!-- databound controls -->
<dmf:datagridRow >
<!-- celllist defines the order and which fields to display from the query -->
<dmf:celllist fields='tel'>
<!-- field specific cell template -->
<dmf:celltemplate field='tel'>
<td>
<!-- generate checkboxes for template -->
<dmf:datagrid name='childGrid' cellspacing='1' cellpadding='2' bordersize='0'>
<!-- databound controls -->
<dmf:datagridRow >
<!-- celllist defines the order and which fields to display from the query -->
<dmf:celllist fields='object_name'>
<!-- field specific cell template -->
<dmf:celltemplate field='object_name'>
<td>
<dmf:label name="lblTemplate" style="font-size:12pt" datafield='CURRENT'/>
</td>
<td>
<dmf:checkbox name="chkTemplate" style="font-size:12pt" datafield='CURRENT'>
<dmf:argument name="objectId" datafield="r_object_id"/>
</dmf:checkbox>
</td>
</dmf:celltemplate>
<!-- generic cell template (matches ALL remaining fields) -->
<dmf:celltemplate>
<td>
<dmf:label datafield='CURRENT'/>
</td>
</dmf:celltemplate>
</dmf:celllist>
</dmf:datagridRow>
</dmf:datagrid>
</td>
<td>
<dmf:button label="Submit" name="btnSubmit" style="font-size:12pt" onclick=""/>
</td>
</dmf:celltemplate>
<!-- generic cell template (matches ALL remaining fields) -->
<dmf:celltemplate>
<td>
<dmf:label datafield='CURRENT'/>
</td>
</dmf:celltemplate>
</dmf:celllist>
</dmf:datagridRow>
</dmf:datagrid>
<br />
</td>
</tr>
</table>
</dmf:panel>
---------------------------------------------------------------------------------------------------
//at onRender
parentGrid = (Datagrid) getControl("parentGrid", Datagrid.class);
parentGrid.getDataProvider().clearResults();
parentGrid.getDataProvider().setDfSession(getDfSession());
parentGrid.getDataProvider().setQuery("dql to produce 5 rows");
parentGrid.getDataProvider().initBind();
childGrid = (Datagrid) getControl("childGrid", Datagrid.class);
childGrid.getDataProvider().clearResults();
childGrid.getDataProvider().setDfSession(getDfSession());
childGrid.getDataProvider().setQuery("dql to produce another 3 rows");
childGrid.getDataProvider().initBind();
Somehow, the checkboxes are only displayed for the 1st row of the parent datagrid and not the others. Am I missing something here?
I also need to retrieve the values of the checkboxes within the datagrid when the submit button is clicked. How should I retrieve this value?
Thanks in advance.