3

Usually PrimeFaces uses java object get methods to set the values for a data table component. Is there a way to instead use a JSON request to fill the table with data?

Sample Data Table:

<p:dataTable var="car" value="#{dtBasicView.cars}">
    <p:column headerText="Id">
        <h:outputText value="#{car.id}" />
    </p:column>

    <p:column headerText="Year">
        <h:outputText value="#{car.year}" />
    </p:column>

    <p:column headerText="Brand">
        <h:outputText value="#{car.brand}" />
    </p:column>

    <p:column headerText="Color">
        <h:outputText value="#{car.color}" />
    </p:column>
</p:dataTable>

Instead is there a way to do:

<p:dataTable var="car" data-url="data1.json">

or some equivalent?

What about using tag to request JSON data and fill the table?

I am looking for a way to request JSON from HTML to fill a prime faces component in the view not the managed bean controller.

wwjdm
  • 2,178
  • 6
  • 27
  • 51

1 Answers1

3

Replace the first word of your question with 'always' and you have your answer: you can't.

Use the PrimeUI datatable instead: http://www.primefaces.org/primeui/#datatable

Kukeltje
  • 11,924
  • 4
  • 19
  • 44