2 Replies Latest reply on Dec 7, 2011 10:02 PM by Lu Han

    It doesn't reload the collection in datatable[upgrade from rf3.3.3 to rf4.1]

    Lu Han Newbie

      Hi guys,

      I met an issue about the collection refresh.

      When I delete one row and then go to the same page, the model collection doesn't refresh.

       

      Firstly, I like to show my code:

       

      This is the datatable code:

       

      <rich:dataTable id="itemList" width="100%" rows="#{groupsBean.pageSize}" value="#{groupsBean.groupList}" var="group" rowClasses="tb_row_1,tb_row_2">

        ...

      </rich:dataTable>

       

       

      This is the java code, this class is a viewscoped one:

      @ManagedBean

      @ViewScoped

      public class GroupsBean extends DirectoryBean {

        private ArrayList<Group> groupList;

      ...

        protected void freshList() {

      ...

             groupList = groupHandler.getAllGroup(memberId, getPageIndex(), pageSize);

      ...

        }

       

      I have to change the code as the below, it will work well:

       

                protected void freshList() {

      ...

                     ArrayList<Group> list = groupHandler.getAllGroup(memberId, getPageIndex(), pageSize);

                     groupList.clear();

                     groupList.addAll(list);

      ...

                }

       

      I suppose, it's jsf2 mechanism of the page state.

      Do you have some idea to solve this issue?

       

      Thanks,

      Eric Han