Reputation: 41
I have a DataTable and want to persist filters. I can save filter values and put them back by calling the datatable. I put filter values back on rendering. Now i want the table to be filtered.
Yes, i want to call a service and to get all data from it Then i want to filter the table with values staying in filter fields.
I can't find a solution to start the filtering after the table got rendered. Solution with overriding PrimeFaces methods can't be used in my situation.
Update:I'm trying not to use additional js, if a problem could be solved with Java or xhtml
I'm using Primefaces 3.5
Do you have any ideas?
Thank you! :)
Upvotes: 2
Views: 6824
Reputation: 389
you have to invoke it's client side filter() method
oncomplete="PF('dataTableWidgetVar').filter()"
or by using:
oncomplete="PF('dataTableWidgetVar').clearFilters()"
Upvotes: 0
Reputation: 101
I had a similar problem. I wanted to put a few persisted Filters in my DT and filter it initialy.
After a few houres I came up with this:
<p:remoteCommand name="onload" oncomplete="PF('ticketTable').filter()" autoRun="true"/>
The <p:remoteCommand>
triggers PF("ticketTable').filter()
after the page is loaded/reloaded.
It uses the onload
event of the <h:body>
.
I found it here : Execute managebean method from javascript onload event
By the way. I'm using PF 5.0, but the remoteCommand is also present in 3.5 according to the Documentation. So it should work in 3.5 too.
I hope I can help you.
Regards FlyingSpaten
Upvotes: 7