|
自己写了一个action,在前台使用scrollview下拉加载更多时,重复加载第一页数据是什么原因?后台返回的数据格式符合要求,下拉刷新也可以,就是上拉加载更多不知道为什么后台:
- public static JSONObject getDataStatistics(JSONObject params, ActionContext context) throws SQLException, NamingException, java.sql.SQLException {
- String searchStr = params.getString("searchStr");
- String marketID = params.getString("marketID");
- Object column = params.get("columns");
- Integer limit = params.getInteger("limit");
- Table table = null;
- Connection conn = context.getConnection(DATASOURCE_CRZD);
- String sql = "";
- try {
- sql = "select AddUserID,StockID,StockName,sum(StockCount) as StockCount from (select AddUserID, StockID, StockName, COUNT(*) as StockCount from V_Receive "
- + "where (IsDelete != 1 OR IsDelete IS NULL) " + searchStr + " AND MarketID = '" + marketID + "' group by AddUserID,StockID,StockName union all "
- + "select AddUserID, StockID, StockName, SUM(cast(StockCount as INT)) as StockCount from V_ReceiveSubNewS where (IsDelete != 1 OR IsDelete IS NULL) " + searchStr
- + " AND MarketID = '" + marketID + "' group by AddUserID,StockID,StockName)a group by AddUserID,StockID,StockName";
- String orderSql = " ORDER BY AddUserID,StockName";
- <font color="#ff0000"> table</font> = DataUtils.queryData(conn, sql+orderSql, null, column, null, limit);
- String countSql = "select count(*) from (" + sql + ")t";
- <font color="#ff0000"> table.setTotal</font>(Integer.parseInt(DataUtils.getValueBySQL(conn, countSql, null).toString()));
- return Transform.tableToJson(table);
- } finally {
- conn.close();
- }
- }
复制代码 前台调用部分:
- var params = {
- searchStr : searchStr,
- marketID : localStorage.getItem("marketID"),
- columns : justep.Baas.getDataColumns(data),
- limit : event.limit
- };
- // 从后台获得统计数据
- justep.Baas.sendRequest({
- "url" : "/crzd/crzd",
- "action" : "getDataStatistics",
- "async" : false,
- "params" : params,
- "success" : function(ret) {debugger
- if(data.count()===0){
- data.setTotal(ret.total);
- }
- data.loadData(ret.table,event.options.append);
- }
- });
复制代码
|
|