3 Replies Latest reply on Nov 8, 2011 4:39 PM by Brendan Healey

    Clearing extendeddatatable selection

    Michael G Novice



      I was wondering how i can clear the selection in the extenddatatable when i rerender it?  Basically, i want to get it back to the initial state before anything was selected.  What is the best way to do this?  I'm using RF4.0.0



        • 1. Re: Clearing extendeddatatable selection
          Brendan Healey Master

          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}"/>




          private Collection<Object> selectedRow;


          public void resetSelectedRow(ComponentSystemEvent cse) {

                  if(!isAjaxRequest()) {

                      selectedRow = null;




          public boolean isAjaxRequest() {

                  return FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest();





          • 2. Re: Clearing extendeddatatable selection
            Michael G Novice

            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
              Brendan Healey Master

              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.