homena / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Problem maxRows limit Limit to efficiently pull data #361

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dear Jeff,

I using the jmesa table rendering api in my project.

I have a problem when using the Limit to efficiently pull data, i folowed the 
tutorial "limit v3" and all is correct when use the default configuration for 
the pagination component, but when put the maxRows and maxRowIncrements in jsp 
tag i obtain the exception: ""The maxRowIncrements does not contain the 
maxRows." in method  public String render() on 
org.jmesa.view.html.toolbar.MaxRowsItemRenderer. I think that exception occur 
because maxRows is not obtain for the jsp tag "<jmesa:tableModel maxRows="1", 
the maxRows is obtain for the jmesa.properties:

html.toolbar.maxPageNumbers=5

My code is:

Collection<?> items=TableModelUtils.getItems("listaSolicitudes", 
ServletActionContext.getRequest(), new PageItems() {
                @Override
                public int getTotalRows(Limit limit) {

                  try {
                    return solicitudService.contadorSolicitudes(usuarioLogeado.getDni());
                } catch (ServiceException e) {
                    e.printStackTrace();
                    setLogError(LOG, ADD, e);
                    return -1;
                }
              }  
                @Override
              public Collection<?> getItems(Limit limit) {
                  int rowStart = limit.getRowSelect().getRowStart();
                  int rowEnd = limit.getRowSelect().getRowEnd();
                  SortSet sortSet = limit.getSortSet();
                  Collection<Sort> sorts = sortSet.getSorts();
                  String orderBy = "";
                  for (Sort sort : sorts) {
                      String property = sort.getProperty();
                      String order = sort.getOrder().toParam();
                      if (orderBy.equals("")){
                      orderBy=  orderBy +  property + " " + order;
                      }else{
                      orderBy= orderBy + "," +  property + " " + order;
                      }
                  }
                                    try {
                         lista= solicitudService.listarByUsuario(usuarioLogeado.getDni(), String.valueOf(rowStart), String.valueOf(rowEnd),orderBy);
                       } catch (ServiceException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                       }
                  return lista;

Can you help me?,any help is very very welcomme.

Best Regards,

Original issue reported on code.google.com by javieralfaya on 20 Feb 2014 at 4:06