-
1. Re: Clearing extendeddatatable selection
healeyb Nov 8, 2011 5:12 AM (in response to mpgong)Hi, here I'm assuming that the datatable will be the target of ajax render= and that I
don't want to reset the selection in that case:
<rich:extendedDataTable selection="#{bean.selectedRow}" ...>
<f:event type="preRenderComponent" listener="#{bean.resetSelectedRow}"/>
Bean.java
--------------
private Collection<Object> selectedRow;
public void resetSelectedRow(ComponentSystemEvent cse) {
if(!isAjaxRequest()) {
selectedRow = null;
}
}
public boolean isAjaxRequest() {
return FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest();
}
Regards,
Brendan.
-
2. Re: Clearing extendeddatatable selection
mpgong Nov 8, 2011 9:04 AM (in response to healeyb)Thanks for the reply Brendan.
The rerendering occurs when i change selection in a <rich:select>, i use the a4j:ajax render to rerender the datatable.
If things are resetting, i couldn't tell since the selected row bolding/highlighting stays with the selected row even after the call to reset it is occuring.
So when i change the selection in the <rich:select> and get new data to populate in the table, i still see the same row selected from the previous data.
This seems to cause me problems when i change the data in the table to something else, sometimes the data won't change. That is why i want to get the table to rerender like to its initial state.
So the code you have is called but the selection collection being set to null doesn't seem to put me back into the initial state.
-
3. Re: Clearing extendeddatatable selection
healeyb Nov 8, 2011 4:39 PM (in response to mpgong)You need to post code if you really need an answer. Guessing, you're not doing database refreshes
in your getters, so you must be doing them somewhere. When you "refresh" your datatable with render=
make sure that the "value=" contains the up to date data.