myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Punz <werner.p...@gmail.com>
Subject Re: [core] best way for editable table
Date Tue, 07 Jun 2011 20:05:20 GMT
I opted for approach 1 in one project i have on github, speed is not 
really an issue since you display only a handful of datasets anyway, but 
I tried to keep the editable information outside of the lifecycle
to avoid unnecessary saves and restores.

Werner




Am 07.06.11 21:29, schrieb Martin Koci:
> 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
>
>
>
>



Mime
View raw message