Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-229

DataList does not work correctly like a DataTable with input components

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.9m9
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Labels:
      None

      Description

      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);
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mathias.werlitz Mathias Werlitz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: