I have a rich:extendedDataTable
inside a rich:tab
.
I want to refresh the table dataSource
everytime that the table is rendered. It is rendered everytime that the tab is selected.
In a nut:
View:
<rich:tab>
<rich:extendedDataTable data="#{myData.data}"/>
</rich:tab>
Bean:
public class MyData{
List data;
public MyData(){
data = this.refreshData();
}
public List getData(){
return data;
}
public List refreshData(){
//Database things here.
}
}
How can I call to refreshData
everytime that the table is rendered? I can use reRender
on the component that executes an action that modifies data
, but that breaks encapsulation of components and its difficult to maintain. It's better if the table can refresh data
by itself every time that is reRendered
when the tab is activated.
I could use <rich:tab ontabenter='js_function_that_calls_the_server_and_refreshes_the_data'>
but I don't think that is the best option, because you should place the function outside the tab tags and besides it throws two requests instead of just one.
Any ideas? appreciated.