Ani
Ani

Reputation: 742

JSF Primefaces - Include p:row inside a dummy component

I have to dynamically render a row in my table without refreshing the entire table. The table is generated using

<p:outputPanel>
  <p:panel>
    <p:panelGrid>
      <p:row>
        <p:column>

To dynamically render a row without refreshing the entire table, I should be able to include that row in a dummy component like span. And then within my p:ajax update, I should give that dummy component id.

Is my understanding correct? How to do this?

Upvotes: 0

Views: 873

Answers (1)

Emil Kaminski
Emil Kaminski

Reputation: 1885

Just give the row an id and update it using p:ajax or a commandbutton or whatever.

Something like this:

  <p:panelGrid id="panelGrid" style="width: 100%;">

                        <p:row id="rowToUpdate">
                            <p:column>#{playgroundView.testB}</p:column>
                        </p:row>

                        <p:row>
                            <p:column>{playgroundView.testA}</p:column>
                        </p:row>
    </p:panelGrid>

<p:commandButton value="Ajax Submit" id="ajax" styleClass="ui-priority-primary" actionListener="#{playgroundController.alterTest()}" update="rowToUpdate" />

The button will only update/refresh the first row.

Upvotes: 1

Related Questions