From e9c749194dfa427d7ad685c5400edafa9e2e0d1b Mon Sep 17 00:00:00 2001 From: frederico Date: Tue, 26 Jan 2016 12:30:38 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20bug=20#0007052=20-=20Corre=C3=A7=C3=A3o?= =?UTF-8?q?=20no=20PagedListWrapper=20para=20aceitar=20sorts=20com=20mais?= =?UTF-8?q?=20de=20um=20campo.=20Ex:=20sort=3D"auto(campo1,=20campo2)".=20?= =?UTF-8?q?Adicionando=20o=20id=20como=20segunda=20ordena=C3=A7=C3=A3o=20?= =?UTF-8?q?=C3=A9=20poss=C3=ADvel=20garantir=20que=20a=20pagina=C3=A7?= =?UTF-8?q?=C3=A3o=20junto=20com=20a=20ordena=C3=A7=C3=A3o=20sempre=20ir?= =?UTF-8?q?=C3=A1=20ocorrer=20corretamente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@52239 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../paginacion/PagedListWrapper.java | 23 +++++++++++++++---- .../busquedaTotnaofiscalEmpresa.zul | 12 +++++----- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/paginacion/PagedListWrapper.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/paginacion/PagedListWrapper.java index 92fb3f9af..3e782c781 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/paginacion/PagedListWrapper.java +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/paginacion/PagedListWrapper.java @@ -179,21 +179,25 @@ public class PagedListWrapper implements Serializable { final Comparator cmpr = lh.getSortDescending(); if (cmpr instanceof FieldComparator) { String orderBy = ((FieldComparator) cmpr).getOrderBy(); - orderBy = StringUtils.substringBefore(orderBy, "DESC").trim(); + String[] multipleOrderBy = getMultipleOrderBy(orderBy, "DESC"); // update SearchObject with orderBy getSearchObject().clearSorts(); - getSearchObject().addSort(orderBy, true); + for(String ob : multipleOrderBy){ + getSearchObject().addSort(ob,true); + } } } else if ("descending".equals(sortDirection) || "natural".equals(sortDirection) || Strings.isBlank(sortDirection)) { final Comparator cmpr = lh.getSortAscending(); if (cmpr instanceof FieldComparator) { String orderBy = ((FieldComparator) cmpr).getOrderBy(); - orderBy = StringUtils.substringBefore(orderBy, "ASC").trim(); + String[] multipleOrderBy = getMultipleOrderBy(orderBy, "ASC"); // update SearchObject with orderBy getSearchObject().clearSorts(); - getSearchObject().addSort(orderBy, false); + for(String ob : multipleOrderBy){ + getSearchObject().addSort(ob,false); + } } } @@ -209,7 +213,16 @@ public class PagedListWrapper implements Serializable { } } } - + + private String[] getMultipleOrderBy(String orderBy, String ascDesc){ + if(orderBy.contains(",")){ + return orderBy.replace(ascDesc, "").replace(" ", "").split(","); + }else{ + return new String[]{StringUtils.substringBefore(orderBy, ascDesc).trim()}; + } + } + + public PagedListService getPagedListService() { return pagedListService; } diff --git a/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul b/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul index f9dbea844..72cdf9d11 100644 --- a/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul +++ b/web/gui/impressaofiscal/busquedaTotnaofiscalEmpresa.zul @@ -52,16 +52,16 @@ label="${c:l('lb.id')}" sort="auto(fiscaltotnaofiscalId)"/> + label="${c:l('busquedaTotnaofiscalEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa,fiscaltotnaofiscalId)"/> + + + label="${c:l('busquedaTotnaofiscalEmpresaController.descricao.label')}" sort="auto(descricao,fiscaltotnaofiscalId)"/> - - + label="${c:l('busquedaTotnaofiscalEmpresaController.tipoeventoextra.label')}" sort="auto(tipoeventoextra.descTipoEvento,fiscaltotnaofiscalId)"/>