Reputation: 99
In my p:datatable, there is a column named Resolution, consisting of a check box and text. If the box is checked, the text is Resolved, If the box is not checked, then text is Unresolved. I also have a filter box defined for this column so only Resolved or Unresolved entries are shown. If I filter on Resolved, then uncheck the box, the entry is now Unresolved, but it is still showing up. It shouldn't, because it no longer satisfies the filter. My question is how do I force filter() to execute after the last f:ajax render ?
Here is my code snipet:
<p:dataTable id="measurementHistoryTableId"
value="#{measurements.measurementHistoryList}"
var="meas3"
dynamic="true">
<p:column id="resolutionColumn"
filterBy="#{meas3.resolution}"
filterOptions="#{measurements.measurementHistoryOptions}"
sortBy="#{meas3.resolution}" >
<f:facet name="header">
<h:outputText value="#{msgs.MeasurementResolution}" />
</f:facet>
<h:selectBooleanCheckbox value="#{meas3.resolved}" >
<f:ajax event="click" execute="@all" render="resolutionId @this" />
</h:selectBooleanCheckbox>
<h:outputText id="resolutionId" value="#{meas3.resolution}" />
</p:column>
</p:dataTable>
I tried render=@all, but that didn't help. render=@form gives me jQuery.datepicker undefined. I tried to add 'onclick=widget_measurementHistoryTableId.filter()' to the 'h:selectBooleanCheckbox' , but it causes the filter to fire before the 'f:ajax' is executed.
Thanks for any help you could give me. Binh
Upvotes: 1
Views: 1648
Reputation: 12609
I don't know how primefaces filtering works but, if the onclick=widget_measurementHistoryTableId.filter()
works and you jsut want it to be fired after the ajax event, you can do it like this:
<f:ajax event="click" execute="@all" render="resolutionId @this"
onevent="reapplyFilter"/>
And then define the reapplyFilter
js function:
function reapplyFilter(e) {
if (e.status == 'success') {
widget_measurementHistoryTableId.filter();
}
}
Upvotes: 2