setting default value in primefaces datatable Filter
jsf, jsf-2, primefaces
Solution
Use the filterValue property of the column tag in primefaces, something like
<p:datatable ... widgetVar="dataTableWidgetVar">
<p:column ... filterValue="#{BackingBean.defaultValue}">
Then, create a simple function call in javascript for triggering the filter, when the page is ready (the widget vars are created via jQuery in PF):
<script type="text/javascript" target="body">
$j = jQuery;
$j(document).ready( function() {
dataTableWidgetVar.filter();
});
</script>
Problem
I am using primefaces v3.5.On the datatable I am using filter on one column. How can I set a default value to the filter while loading the page Itself.