Permalink
Browse files

当AJAX返回null或者无数据时显示数据加载异常

  • Loading branch information...
miemiedev
miemiedev committed Oct 15, 2013
1 parent f614843 commit c267a064b7c869b125827d6317a726d6f55a1a71
Showing with 8 additions and 3 deletions.
  1. +1 −1 examples/examples1.html
  2. +7 −2 src/mmGrid.js
View
@@ -132,7 +132,7 @@
var mmg = $('.mmg').mmGrid({
height: 400
, cols: cols
- , url: 'data/stockQuotePage.json'
+ //, url: 'data/stockQuotePage.json'
, method: 'get'
, remoteSort:true
, items: items
View
@@ -947,7 +947,7 @@
try{
//获得root对象
var items = data;
- if(data && $.isArray(data[opts.root])){
+ if($.isArray(data[opts.root])){
items = data[opts.root];
}
that._populate(items);
@@ -956,7 +956,12 @@
that._refreshSortStatus();
}
- that.$body.triggerHandler('loadSuccess', $.extend(args, data));
+ if(data && $.isArray(data[opts.root])){
+ data = $.extend(args, data);
+ }
+ that.$body.triggerHandler('loadSuccess', data);
+
+
}catch(e){
that._hideLoading();
that._showLoadError();

0 comments on commit c267a06

Please sign in to comment.