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

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

    feuyeux

      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

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

          I found getGroupList(groupsBean.groupList) is invoked earlier than freshList invoked.

          I expect flow is:

          delete->freshList->getGroupList

          It's so wiered, why page getting invoked firstly? It doesn't keep to the six lifecycle.

          • 2. Re: It doesn't reload the collection in datatable[upgrade from rf3.3.3 to rf4.1]
            feuyeux

            This is the request processing lifecycle log:

             

            show list page:

            --->Before RENDER_RESPONSE 6

            fresh list.

            get group list.

            <---After RENDER_RESPONSE 6

             

            do delete:

            --->Before RESTORE_VIEW 1

            <---After RESTORE_VIEW 1

             

            --->Before APPLY_REQUEST_VALUES 2

            get group list.

            <---After APPLY_REQUEST_VALUES 2

             

            --->Before PROCESS_VALIDATIONS 3

            <---After PROCESS_VALIDATIONS 3

             

            --->Before UPDATE_MODEL_VALUES 4

            <---After UPDATE_MODEL_VALUES 4

             

            --->Before INVOKE_APPLICATION 5

            fresh list.

            <---After INVOKE_APPLICATION 5

             

            --->Before RENDER_RESPONSE 6

            get group list.

            <---After RENDER_RESPONSE 6