[ http://issues.apache.org/jira/browse/MYFACES-229?page=all ]
Martin Marinschek closed MYFACES-229:
-------------------------------------
Resolution: Fixed
Fix Version: Nightly Build
patch by Mathias Werlitz
> DataList does not work correctly like a DataTable with input components
> -----------------------------------------------------------------------
>
> Key: MYFACES-229
> URL: http://issues.apache.org/jira/browse/MYFACES-229
> Project: MyFaces
> Type: Bug
> Versions: 1.0.9 beta
> Reporter: Mathias Werlitz
> Fix For: Nightly Build
>
> I have a problem using the DataList component. I would like to use input
> components within it, but the model isn't updated at all. I use a List a the
> DataList value.
> If I use a DataTable instead everything works fine.
> here an example - does NOT work:
> <h:form>
> <x:dataList id="foo" var="item"
> value="#{myBean.items}" >
> <h:inputText value="#{item.value}" />
> </x:dataList>
>
> <h:commandButton action="save" />
> </h:form>
> but this works:
> <h:form>
> <h:dataTable id="foo" var="item"
> value="#{myBean.items}" >
> <h:inputText value="#{item.value}" />
> </h:dataTable>
>
> <h:commandButton action="save" />
> </h:form>
> I'm not very familia with svn and the patch generation so i will submit my
> solution here. Some of the developers only has to c&p the code ;)
> PROBLEM: Unimplemented methods in
> org.apache.myfaces.custom.datalist.HtmlDataList
> public void processUpdates(FacesContext context);
> public void processValidators(FacesContext context)
> SOLUTION:
> public void processUpdates(FacesContext context) {
> int first = getFirst();
> int rows = getRows();
> int last;
> if (rows == 0)
> {
> last = getRowCount();
> }
> else
> {
> last = first + rows;
> }
> for (int rowIndex = first; rowIndex < last; rowIndex++)
> {
> setRowIndex(rowIndex);
> if (isRowAvailable())
> {
> for (Iterator it = getChildren().iterator(); it.hasNext();)
> {
> UIComponent child = (UIComponent)it.next();
> if (!child.isRendered())
> {
> continue;
> }
> child.processUpdates(context);
> }
> }
> }
> setRowIndex(-1);
> }
>
> public void processValidators(FacesContext context) {
> int first = getFirst();
> int rows = getRows();
> int last;
> if (rows == 0)
> {
> last = getRowCount();
> }
> else
> {
> last = first + rows;
> }
> for (int rowIndex = first; rowIndex < last; rowIndex++)
> {
> setRowIndex(rowIndex);
> if (isRowAvailable())
> {
> for (Iterator it = getChildren().iterator(); it.hasNext();)
> {
> UIComponent child = (UIComponent)it.next();
> if (!child.isRendered())
> {
> continue;
> }
> child.processValidators(context);
> }
> }
> }
> setRowIndex(-1);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira