Authored by liuyue

列表插件

... ... @@ -102,7 +102,6 @@ grid.prototype = {
var result = value.split('='),
key = result[0],
value = result[1];
if (key) {
urlParam[key] = value;
}
... ... @@ -117,13 +116,24 @@ grid.prototype = {
param.page = urlParam.page;
}
if (param.size == p.size) {
if (!param.size) {
param.size = urlParam.size;
}
if (!param.productStatusStr) {
param.productStatusStr = urlParam.productStatusStr;
}
if (param.productStatusStr == 'all') {
param.productStatusStr = '';
}
var urlHash = '';
$.each(param, function(key, value) {
urlParam[key] = value;
});
$.each(urlParam, function(key, value) {
if (value || value == '0') {
urlHash += key + '=' + value + '&&';
}
... ... @@ -193,6 +203,7 @@ grid.prototype = {
ajax: function(param) {
var g = this,
p = this.options;
var timeid;
var ajaxOptions = {
type: 'POST',
url: p.url,
... ... @@ -213,9 +224,16 @@ grid.prototype = {
},
complete: function(res) {
console.log("complete~~");
// p.complete && p.complete();
},
error: function() {
console.log("error~~");
error: function(res) {
console.log("error~~", res);
clearTimeout(timeid);
if (res.status == 429) {
timeid = setTimeout(function() {
g.reload();
}, 800);
}
g.__pagination({
total: 0,
page: 0
... ... @@ -317,20 +335,24 @@ grid.prototype = {
if (!row || !col) return "";
var value = col.name ? row[col.name] : null;
var content = value;
var content = "";
if (col.type) {
content = "<input type='" + col.type + "' name='" + col.name + "' class='wqt_checkbox' data-index='" + row.__index + "'>";
};
if (col.render) {
} else if (col.render) {
content = col.render.call(g, row, value, col);
};
return content ? content : '';
} else {
content = value;
}
if (content || typeof(content) == 'number') {
return content;
} else {
return '';
}
},
reload: function(param) {
var g = this,
p = this.options;
if (param == 1) {
p.page = 1;
}
... ...