Reputation: 2735
How would I go about updating a UI component when a server process finishes or anytime else for that matter?
Can\Should I
If anyone could guide me in the right direction I'd appreciate it.
Example Case One
Server process ends and updates the database.
I want to automatically update a DataTable with new rows based on the new information.
I don't want to poll for the new data.
EDIT
I want to update the UI component (a primefaces datatable) from an EJB Stateless Bean
Upvotes: 0
Views: 3963
Reputation: 2790
You didnt mention which version of primefaces you are using but you can update components from backed bean with addpartialupdatetarget.
RequestContext context = RequestContext.getCurrentInstance();
context.addPartialUpdateTarget("myForm:myComponent");
Upvotes: 1
Reputation: 19294
You can just use the update attribute of your commandButton or whatever else you're using.
Something like this should work
<p:dataTable value="#{backer.bean}" id="table">
// columns with data
</p:dataTable>
<p:commandButton actionListener="#{backer.updateDB}" update="table" />
Upvotes: 0