在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<a href="javascript:setOrder();">表头名字</a>,页面中获取上次点击的表头的名称和这次点击的表头的名称做比较,如果两者相同就按原先相反的顺序排列,否则新列升序排列, 复制代码 代码如下: dataSetName = "fundcatagoryseasontemplate"; sortCol = reportContext.getHttpServletRequest().getParameter("sortCol");//获取需要排序的列名 sortDir = reportContext.getHttpServletRequest().getParameter("sortDir");//获取排列顺序 currentURL = reportContext.getHttpServletRequest().getRequestURL()+"?"+reportContext.getHttpServletRequest().getQueryString(); sortClause = ""; targetURL = ""; if(sortDir != null){ if(sortDir.indexOf("ASC") != -1){ sortDir = "DESC"; }else{ sortDir = "ASC"; } }else{ sortDir = "ASC"; } if(sortCol != null && sortCol.length != 0){ sortClause = " order by " + sortCol + " " + sortDir; } reportContext.getReportRunnable().getDesignInstance().getDataSet(dataSetName).queryText += sortClause; //获取并修改底层sql语句 if(currentURL.indexOf("__sorting=") != -1 ){ targetURL = currentURL.substring(0,currentURL.indexOf("__sorting")-1 ); }else{ targetURL = currentURL; } targetURL = targetURL + "&__sorting=true&sortDir="+sortDir+"&sortCol=";//修改url |
请发表评论