0 Replies Latest reply on Jan 8, 2009 9:08 AM by Matthias Dickgiesser

    Paging in rich:listShuttle

    Matthias Dickgiesser Newbie

      Hello,

      i have a listShuttle with large lists (over 1000 entries), which causes very long loading times or in case of the internet explorer even to crash completely. So i decided to implement a paging-functionality to both lists and limit the entries displayed per page to 250.
      I manipulated the getter for the lists like that.

      
      public List<UserVO> getSourceList() {
      
       ArrayList<UserVO> allUsers = new ArrayList<UserVO>();
      
       allUsers = getAllUsersWithoutTargetValues();
      
       if (allUsers.size() > MAX_LIST_ENTRIES) {
       setSource_paging(true);
       setSource_max_pages(allUsers.size() / MAX_LIST_ENTRIES);
       int rest = allUsers.size() % MAX_LIST_ENTRIES;
       if (rest != 0)
      
       setSource_max_pages(this.source_max_pages + 1);
      
       if (currentPage != source_max_pages && rest != 0) {
       sourceList = allUsers.subList((currentPage - 1) * MAX_LIST_ENTRIES, currentPage * MAX_LIST_ENTRIES);
      
       } else {
       sourceList = allUsers.subList((currentPage - 1) * MAX_LIST_ENTRIES, (currentPage) * MAX_LIST_ENTRIES + rest);
       }
      
       } else {
       setSource_paging(false);
       sourceList = allUsers;
       }
       return sourceList;
       }
      
      


      This works fine for the source list, but if i do it the same way for the target list i always get the shuttle has invalid value expressions error. I guess, the reason for that is that submitted values can't be found in both lists to the time of submit (because there are only fragments of the lists displayed).

      Does anybody around here has a suggestion on how to achieve my goal to make both lists "pagable" ?

      Thanks in advance,
      Exxoo