Rerendering a column of the containing datagrid
cdiggins Jan 25, 2008 12:02 PMI have a datagrid with 5 columns. In one of these columns there is a dropdown of objects that can add or remove a column depending on what is selected. As of now, it seems this does not work. I can have the dropdown render various numbers of columns in other datagrids on the page, but so far have been unable to get it to add or remove a column from the datagrid that it is contained within. Am I missing something, or is this not supported by richFaces?
<rich:dataTable
rowClasses="seamDisplayTableRowOne,seamDisplayTableRowTwo"
rules="cols" value="dailyUse">
<h:column>
<f:facet name="header">Date</f:facet>
<h:inputText value="#{dailyUse.siActivityDateString}" />
</h:column>
<h:column>
<f:facet name="header">Operator</f:facet>
<h:selectOneMenu value="#{dailyUse.siEmployee}"
converter="#{employeeBean.employeeConverter}">
<s:selectItems
value="#{employeeBean.loadEmployeesForCurrentDepartment}"
var="employee" label="#{employee.siEmployeeName}" />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">Equipment</f:facet>
<h:selectOneMenu value="#{dailyUse.siEquipment}"
converter="#{equipmentBean.equipmentConverter}">
<s:selectItems
value="#{equipmentBean.loadEquipmentForCurrentDepartment}"
var="equip" label="#{equip.psTagNumber}" noSelectionLabel="Select Equipment" />
<a:support event="onchange" reRender="milesHoursGrid,PTOColumn" action="#{dailyUseBean.clearMilesHoursList}" />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">Billing Dept</f:facet>
<h:outputText value="#{user.currentDepartment.psDeptID}" />
</h:column>
<s:span id="PTOColumn">
<h:column>
<f:facet name="header">Power Take Off(lbs)</f:facet>
<h:inputText rendered="#{dailyUse.siEquipment.siPowerTakeOff}" value="#{dailyUse.siPowerTakeOff}" />
</h:column>
</s:span>
</rich:dataTable>
In the above example, I am trying to get the 'Power Take Off(lbs)' column to render depending on what is selected in the Equipment dropdown.
If I put the 'rendered' property just around the inputText for powertakoff, that input text does reRender and appear and disappear as it should, but I am left with an empty column. My objective is to get that column to appear is disappear as it needs to.
Thanks.