Showing
1 changed file
with
33 additions
and
11 deletions
@@ -102,7 +102,6 @@ grid.prototype = { | @@ -102,7 +102,6 @@ grid.prototype = { | ||
102 | var result = value.split('='), | 102 | var result = value.split('='), |
103 | key = result[0], | 103 | key = result[0], |
104 | value = result[1]; | 104 | value = result[1]; |
105 | - | ||
106 | if (key) { | 105 | if (key) { |
107 | urlParam[key] = value; | 106 | urlParam[key] = value; |
108 | } | 107 | } |
@@ -117,13 +116,24 @@ grid.prototype = { | @@ -117,13 +116,24 @@ grid.prototype = { | ||
117 | param.page = urlParam.page; | 116 | param.page = urlParam.page; |
118 | } | 117 | } |
119 | 118 | ||
120 | - if (param.size == p.size) { | 119 | + if (!param.size) { |
121 | param.size = urlParam.size; | 120 | param.size = urlParam.size; |
122 | } | 121 | } |
123 | 122 | ||
123 | + if (!param.productStatusStr) { | ||
124 | + param.productStatusStr = urlParam.productStatusStr; | ||
125 | + } | ||
126 | + | ||
127 | + if (param.productStatusStr == 'all') { | ||
128 | + param.productStatusStr = ''; | ||
129 | + } | ||
124 | 130 | ||
125 | var urlHash = ''; | 131 | var urlHash = ''; |
126 | $.each(param, function(key, value) { | 132 | $.each(param, function(key, value) { |
133 | + urlParam[key] = value; | ||
134 | + }); | ||
135 | + | ||
136 | + $.each(urlParam, function(key, value) { | ||
127 | if (value || value == '0') { | 137 | if (value || value == '0') { |
128 | urlHash += key + '=' + value + '&&'; | 138 | urlHash += key + '=' + value + '&&'; |
129 | } | 139 | } |
@@ -193,6 +203,7 @@ grid.prototype = { | @@ -193,6 +203,7 @@ grid.prototype = { | ||
193 | ajax: function(param) { | 203 | ajax: function(param) { |
194 | var g = this, | 204 | var g = this, |
195 | p = this.options; | 205 | p = this.options; |
206 | + var timeid; | ||
196 | var ajaxOptions = { | 207 | var ajaxOptions = { |
197 | type: 'POST', | 208 | type: 'POST', |
198 | url: p.url, | 209 | url: p.url, |
@@ -213,9 +224,16 @@ grid.prototype = { | @@ -213,9 +224,16 @@ grid.prototype = { | ||
213 | }, | 224 | }, |
214 | complete: function(res) { | 225 | complete: function(res) { |
215 | console.log("complete~~"); | 226 | console.log("complete~~"); |
227 | + // p.complete && p.complete(); | ||
216 | }, | 228 | }, |
217 | - error: function() { | ||
218 | - console.log("error~~"); | 229 | + error: function(res) { |
230 | + console.log("error~~", res); | ||
231 | + clearTimeout(timeid); | ||
232 | + if (res.status == 429) { | ||
233 | + timeid = setTimeout(function() { | ||
234 | + g.reload(); | ||
235 | + }, 800); | ||
236 | + } | ||
219 | g.__pagination({ | 237 | g.__pagination({ |
220 | total: 0, | 238 | total: 0, |
221 | page: 0 | 239 | page: 0 |
@@ -317,20 +335,24 @@ grid.prototype = { | @@ -317,20 +335,24 @@ grid.prototype = { | ||
317 | if (!row || !col) return ""; | 335 | if (!row || !col) return ""; |
318 | var value = col.name ? row[col.name] : null; | 336 | var value = col.name ? row[col.name] : null; |
319 | 337 | ||
320 | - var content = value; | 338 | + var content = ""; |
321 | if (col.type) { | 339 | if (col.type) { |
322 | content = "<input type='" + col.type + "' name='" + col.name + "' class='wqt_checkbox' data-index='" + row.__index + "'>"; | 340 | content = "<input type='" + col.type + "' name='" + col.name + "' class='wqt_checkbox' data-index='" + row.__index + "'>"; |
323 | - }; | ||
324 | - | ||
325 | - if (col.render) { | 341 | + } else if (col.render) { |
326 | content = col.render.call(g, row, value, col); | 342 | content = col.render.call(g, row, value, col); |
327 | - }; | ||
328 | - | ||
329 | - return content ? content : ''; | 343 | + } else { |
344 | + content = value; | ||
345 | + } | ||
346 | + if (content || typeof(content) == 'number') { | ||
347 | + return content; | ||
348 | + } else { | ||
349 | + return ''; | ||
350 | + } | ||
330 | }, | 351 | }, |
331 | reload: function(param) { | 352 | reload: function(param) { |
332 | var g = this, | 353 | var g = this, |
333 | p = this.options; | 354 | p = this.options; |
355 | + | ||
334 | if (param == 1) { | 356 | if (param == 1) { |
335 | p.page = 1; | 357 | p.page = 1; |
336 | } | 358 | } |
-
Please register or login to post a comment