Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-91

Pagination in Scaffolding can only go two pages deep

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Beta2
    • 1.0.0.Beta1
    • Scaffold
    • None

      http://seamframework.org/162255.lace

      this pagination code of https://github.com/forge/core/blob/master/scaffold-metawidget/src/main/resources/org/metawidget/scaffold/BackingBean.jv,

      pagination = new PaginationHelper<xyz.class&gt;(10)

      will get executed every time next button is pressed (as the backing bean is requestscope) hence will not be able to navigate to 3 rd page, this should be bug in my opinion. I have given short term work around for this, let see what experts have to say.

      public PaginationHelper<@{entity.getName()}> getPagination(){
      	if (pagination == null){
      		pagination = new PaginationHelper<@{entity.getName()}>(10){
      			@Override
      			public int getItemsCount() {
      				return count(@{entity.getName()}.class);
      			}
      			@Override
      			public List<@{entity.getName()}> createPageDataModel(){
      				return new ArrayList<@{entity.getName()}>(findAll(@{entity.getName()}.class,
      						 getPageFirstItem(), getPageSize() ));
      			}
      		};
      	}
      	return pagination;
      }

              lincolnthree Lincoln Baxter III (Inactive)
              lincolnthree Lincoln Baxter III (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: