查询脚本jquery出错:TypeError: rows is undefined
来源:互联网 发布:怎么看淘宝店铺的销量 编辑:程序博客网 时间:2024/06/11 09:47
今天使用BUI做一个查询功能,返回值是一个List,并且还需要分页。而后台查询的结果没有报错。
然而前台使用firebug查出了报TypeError: rows is undefined这个错误。我通过后台的debug查询到返回的List的查询可能为空。然而分页需要后台传入的总记录数和总记录,分别为0和null。然而BUI通过这两个属性接收的时候 root:'list'、totalProperty:'totals',主要是由于接收的list字段为null。如果我们想要前端BUI查询的结果同时也显示空记录的话,是不能接收 root:'null'这样的。意思就是对象的属性可以为空,但是对象本身不能为空。所以解决办法就是当查询结果为空的时候,不直接将查询结果传过来,而是采用判断是否为空,如果为空的话,就新建一个list,然后不赋值,只是创建了一个对象传到BUI框架的页面需要的解析的list对象。这样就保证了对象的属性为空,但是对象本身不为空。
之前处理方式:
Map<String,Object> resultMap=new HashMap<String,Object>();resultMap.put("list", list);resultMap.put("totals", page.getTotalRowsAmount());解决问题的处理方式:
Map<String,Object> resultMap=new HashMap<String,Object>();if(page.getTotalRowsAmount() ==0){resultMap.put("list", new ArrayList<String>());}else{resultMap.put("list", list);}resultMap.put("totals", page.getTotalRowsAmount());------------------------------------------------------------------------------------
说明BUI框架在接收后端传过来的对象的时候,不能接收null对象。
0 0
- 查询脚本jquery出错:TypeError: rows is undefined
- TypeError: $.data(...).data.rows is undefined报错及解决方法
- jQuery Validation插件onfocosout/onkeyup出错的解决方法[Uncaught TypeError: undefined is not a function中文资料不好找]
- TypeError: d is undefined
- TypeError: swfuploadify is undefined
- TypeError:e is undefined
- JQuery datatables 报错:TypeError: aLayout[(i + k)] is undefined
- TypeError: col.cellSelector is undefined
- TypeError:this.K is undefined
- TypeError: elem.nodeName is undefined
- JQuery之——使用jquery插件报错:TypeError:$.browser is undefined的解决方法
- Extjs毕业设计:在做分页查询产品信息时,出现TypeError: this.ds is undefined?
- TypeError: elem is undefined var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase
- 使用jquery插件报错:TypeError:$.browser is undefined的解决方法
- 使用jquery插件报错:TypeError:$.browser is undefined的解决方法
- 在使用JQuery插件时报错:TypeError:$.browser is undefined的解决方法
- 使用jquery插件报错:TypeError:$.browser is undefined的解决方法
- TypeError:Components.classes[cid] is undefined
- Fiddler手机抓包工具如何设置过滤域名
- 十一章 上机4
- java自带线程池和队列详细讲解
- VS2015使用scanf报错解决方案
- Mysql中类似于nvl()函数的ifnull()函数
- 查询脚本jquery出错:TypeError: rows is undefined
- Codeforces Round #381 (Div. 2) D. Alyona and a tree
- http://blog.csdn.NET/xiabo851205/article/details/7991529
- C# 第11章
- ubuntu开启mysql远程端口 3306
- WebRTC VideoEngine综合应用示例(三)——集成X264编码和ffmpeg解码
- 十一章 上机5
- gitlab下对php代码进行检测
- Leetcode71: Simplify Path