Authored by weiqingting

列表分页控件

... ... @@ -89,8 +89,7 @@ grid.prototype = {
p = this.options;
var param = {},
urlParam = {},
urlArr = location.hash.substring(1).split('&&');
urlParam = {};
if (p.parms) {
if (typeof(p.parms) == "function") {
... ... @@ -98,26 +97,26 @@ grid.prototype = {
}
}
$.each(urlArr, function(i, value) {
var result = value.split('='),
key = result[0],
value = result[1];
if (key) {
urlParam[key] = value;
}
});
$.each(urlParam, function(key, value) {
if (!param[key] && param[key] !== +param[key]) {
param[key] = value;
}
});
if (param.page !== p.page) {
param.page = p.page;
} else {
param.page = urlParam.page;
}
if(location.hash.search(/page=(\d+)/g)>-1){
param.page = /page=(\d+)/g.exec(location.hash)[1];
}
}
if(param.page&&p.hash){
if(location.hash.search(/page=(\d+)/g)>-1){
location.hash=location.hash.replace(/page=(\d+)/g,function(source,$1){
return "page="+param.page;
})
}else{
location.hash+="page="+param.page;
}
}
if (param.productStatusStr == 'all') {
param.productStatusStr = '';
}
... ... @@ -125,15 +124,6 @@ grid.prototype = {
if (param.isInfoMiss == 'N') {
param.isInfoMiss = '';
}
var urlHash = '';
$.each(param, function(key, value) {
if (value || value == '0') {
urlHash += key + '=' + value + '&&';
}
});
if (p.hash) {
location.hash = urlHash;
}
return param;
},
... ...