Author: dmorozov
Date: 2007-06-27 08:50:12 -0400 (Wed, 27 Jun 2007)
New Revision: 1335
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
Add some fail checks
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-06-27
10:42:57 UTC (rev 1334)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-06-27
12:50:12 UTC (rev 1335)
@@ -87,8 +87,16 @@
else {
if(!target)
ClientUILib.log(ClientUILogger.ERROR, "DOM Element with id " + id + "
not found for update.");
- if(!src)
+ if(!src) {
ClientUILib.log(ClientUILogger.ERROR, "RESPONSE Element with id " + id +
" not found for update.");
+
+ // cleanup destination
+ if(target) {
+ for(var i=0; i<target.cells.length; i++) {
+ target.cells[i].innerHTML = "";
+ }
+ }
+ }
}
},
@@ -197,7 +205,8 @@
var dataModel = grid.dataModel;
var baseid = clientid;
- var rowsForUpdate = callbacks ? new Array(count) : null;
+ var countForUpdate = 0;
+ var rowsForUpdate = [];
for(i=0; i<count; i++) {
rowindex = startRow + i;
if(rowindex >= rowCount){
@@ -212,19 +221,22 @@
// just suspend operation for future
if(!rowsForUpdate[i]) rowsForUpdate[i] = {};
rowsForUpdate[i][suffix] = {index : rowindex, row : row};
+ countForUpdate++;
}
}
);
}
- if (callbacks) {
+ if (callbacks && countForUpdate>0) {
// process suspended processing
setTimeout(function(){
for(var i=0; i<count; i++) {
callbacks.unbreakableEach(
function(callback) {
- callback.call(grid, rowsForUpdate[i][":f:"]);
- callback.call(grid, rowsForUpdate[i][":n:"]);
+ if(rowsForUpdate[i]) {
+ if(rowsForUpdate[i][":f:"].row) callback.call(grid,
rowsForUpdate[i][":f:"]);
+ if(rowsForUpdate[i][":n:"].row) callback.call(grid,
rowsForUpdate[i][":n:"]);
+ }
}
);
}
Show replies by date