简体   繁体   中英

How can I render another attribute from a p:dataTable of the same row (JSF)?

I am working with JSF 2.2 and Primefaces 6.0. I have a p:dataTable with different p:column s, and each column has many rows. I would like that, whenever column1 input changes, column2 input , in the same row, updates, however, it is not working; it doesn't render.

This is my xhtml code:

<p:dataTable value="#{myBean.objectsList}" var="object">
  <p:column headerText="column1">
    <table>
      <tbody>
        <ui:repeat value="#{object.subObjects}" var="object2">
          <tr>
            <td>
              <c:set var="object3" value="#{object2.subObjects}"/>
              <h:inputText id="value1#{myBean.toString(object3)}" value="#{object3.value1}">
                <f:ajax event="change" listener="#{myBean.doSomething}"
                        execute="@this" render="@this"/>
              </h:inputText>
            </td>
          </tr>
        </ui:repeat>
      </tbody>
    </table>
  </p:column>
  <p:column headerText="column2">
    <table>
      <tbody>
        <ui:repeat value="#{object.subObjects}" var="object2">
          <tr>
            <td>
              <c:set var="object3" value="#{object2.subObjects}"/>
              <h:inputText value="#{object3.value2}" disabled="disabled">
                <f:ajax event="change" listener="#{myBean.doSomething2}"
                        execute="@this" render="value1#{myBean.toString(object3)}"/>
              </h:inputText>
            </td>
          </tr>
        </ui:repeat>
      </tbody>
    </table>
  </p:column>
</p:dataTable>

Each object has many objects as a List .

In f:ajax tag of the first column ( column1 ), you have given @this as value for the attribute render . Instead, please try giving id of the component column2 or id of the p:dataTable itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM