起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1387|回复: 2

[结贴] 自定义action使用scollview上拉加载更多时重复加载第一页数据

[复制链接]

65

主题

315

帖子

851

积分

高级会员

Rank: 4

积分
851
发表于 2016-8-30 03:17:11 | 显示全部楼层 |阅读模式
自己写了一个action,在前台使用scrollview下拉加载更多时,重复加载第一页数据是什么原因?后台返回的数据格式符合要求,下拉刷新也可以,就是上拉加载更多不知道为什么后台:
  1. public static JSONObject getDataStatistics(JSONObject params, ActionContext context) throws SQLException, NamingException, java.sql.SQLException {

  2.                 String searchStr = params.getString("searchStr");
  3.                 String marketID = params.getString("marketID");
  4.                 Object column = params.get("columns");
  5.         Integer limit = params.getInteger("limit");

  6.                 Table table = null;
  7.                 Connection conn = context.getConnection(DATASOURCE_CRZD);
  8.                 String sql = "";
  9.                 try {
  10.                         sql = "select AddUserID,StockID,StockName,sum(StockCount) as StockCount from (select AddUserID, StockID, StockName, COUNT(*) as StockCount from V_Receive "
  11.                                         + "where (IsDelete != 1 OR IsDelete IS NULL) " + searchStr + " AND MarketID = '" + marketID + "' group by AddUserID,StockID,StockName union all "
  12.                                         + "select AddUserID, StockID, StockName, SUM(cast(StockCount as INT)) as StockCount from V_ReceiveSubNewS where (IsDelete != 1 OR IsDelete IS NULL) " + searchStr
  13.                                         + " AND MarketID = '" + marketID + "' group by AddUserID,StockID,StockName)a group by AddUserID,StockID,StockName";
  14.                         String orderSql = " ORDER BY AddUserID,StockName";
  15. <font color="#ff0000">                        table</font> = DataUtils.queryData(conn, sql+orderSql, null, column, null, limit);
  16.                         String countSql = "select count(*) from (" + sql + ")t";
  17. <font color="#ff0000">            table.setTotal</font>(Integer.parseInt(DataUtils.getValueBySQL(conn, countSql, null).toString()));
  18.                         return Transform.tableToJson(table);

  19.                 } finally {
  20.                         conn.close();
  21.                 }
  22.         }
复制代码
前台调用部分:
  1. var params = {
  2.                                 searchStr : searchStr,
  3.                                 marketID : localStorage.getItem("marketID"),
  4.                                 columns : justep.Baas.getDataColumns(data),
  5.                 limit : event.limit
  6.                 };
  7.                 // 从后台获得统计数据
  8.                 justep.Baas.sendRequest({
  9.                         "url" : "/crzd/crzd",
  10.                         "action" : "getDataStatistics",
  11.                         "async" : false,
  12.                         "params" : params,
  13.                         "success" : function(ret) {debugger
  14.                                 if(data.count()===0){
  15.                                         data.setTotal(ret.total);
  16.                                 }
  17.                                 data.loadData(ret.table,event.options.append);
  18.                         }
  19.                 });
复制代码





5

主题

49

帖子

133

积分

初级会员

Rank: 2

积分
133
QQ
发表于 2016-8-30 09:41:54 | 显示全部楼层
QQ截图20160830094038.png offset必须有
初学Wex5
回复 支持 反对

使用道具 举报

65

主题

315

帖子

851

积分

高级会员

Rank: 4

积分
851
 楼主| 发表于 2016-8-30 10:32:23 | 显示全部楼层

非常感谢,之前试过加offset,但不知道具体怎么用的,给了固定值,所以没有效果。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-18 22:27 , Processed in 0.086636 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表