Hi,

how to do editable table in JSF? Not with all rows/cell in editable
state,  only with those ones which user switch with icon to update
state.

Example:
<a:column id="emailColumn">
   <a:inputText id="email" value="#{rowData.email}" />
</a:column>

<a:column>
 <h:commandButton value="Switch to update"
actionListener="#{rowData.switchToUpdate}" />
</a:column>


Solution 1:
add ValueExpression to attribute determines state of component:

<a:inputText id="email" value="#{suser.email}" displayValueOnly="#{!
rowData.editableState}"/>

This solution has serious disadvantages:
-- you must add expression to each component
-- for required additional expression is needed:
required="#{rowData.required}" 
-- evaluation of VEs for each row is very slow


Solution 2:
use DataModelListener

Use o implementation of DataModelListener and when UIData scrolls to
row, set property of component directly:
uiComponent.setDisplayValueOnly(true|false)

Disadvantages:
-- dependency on DataModel as value for UIData
-- cannot be done from plain XHTML



What do you think about this problem? Do you know any elegant solution
for this?

Thanks,

Kočičák



Reply via email to