Author: dmorozov
Date: 2007-06-21 07:41:43 -0400 (Thu, 21 Jun 2007)
New Revision: 1248
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Log:
Improve performance under IE
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-21
11:38:04 UTC (rev 1247)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-06-21
11:41:43 UTC (rev 1248)
@@ -42,46 +42,54 @@
var target = document.getElementById(id);
var src = request.getElementById(id);
- Utils.DOM.Event.removeListeners(target);
-
- if (ClientUILib.isIE) {
- var theDoc = document;
- var createEl = theDoc.createElement;
+ if(target && src) {
+ Utils.DOM.Event.removeListeners(target);
- // if we need in clean tr node why we clone it?
- //var row = target.cloneNode(false);
- //this._clearAttributes(row);
- var row = createEl( "TR" );
- this.copyAttributes(row, src);
-
- var tdNode, tdSrc;
- var childs = src.childNodes;
- var count = childs.length;
- var innerHTML, j, innerCount;
- for(var i=0; i<count; i++) {
- tdSrc = childs[i];
- tdNode = createEl( "TD" );
- //this.copyAttributes(tdNode, tdSrc);
- tdNode.className = "ClientUI_Grid_BC";
- row.insertBefore(tdNode, null);
+ if (ClientUILib.isIE) {
+ var theDoc = document;
+ var createEl = theDoc.createElement;
- innerHTML = [];
- innerCount = tdSrc.childNodes.length;
- for(j=0; j<innerCount; j++) {
- innerHTML.push(tdSrc.childNodes[j].xml);
+ row = createEl( "TR" );
+ Utils.DOM.copyAttributes(row, src);
+
+ var tdSrc, tdNode;
+ var childs = src.childNodes;
+ var ccount = childs.length;
+ for(var k=0; k<ccount; k++) {
+ tdSrc = childs[k];
+ tdNode = createEl( "TD" );
+ //Utils.DOM.copyAttributes(tdNode, tdSrc);
+ tdNode.className = "ClientUI_Grid_BC";
+ row.insertBefore(tdNode, null);
+
+ innerHTML = [];
+ innerCount = tdSrc.childNodes.length;
+ for(j=0; j<innerCount; j++) {
+ innerHTML.push(tdSrc.childNodes[j].xml);
+ }
+ tdNode.innerHTML = innerHTML.join("");
}
- tdNode.innerHTML = innerHTML.join();
+
+ target.parentNode.replaceChild(row, target);
+ return row;
+
+ } else {
+ Element.hide(target);
+ Utils.DOM.Event.removeListeners(target);
+
+ Utils.DOM._clearAttributes(target);
+ target.innerHTML = src.innerHTML;
+ Utils.DOM.copyAttributes(target, src);
+ Element.show(target);
+ return target;
}
- target.parentNode.replaceChild(row, target);
- return row;
-
- } else {
- target.innerHTML = src.innerHTML;
- this._clearAttributes(target);
- this.copyAttributes(target, src);
- return target;
-
}
+ else {
+ if(!target)
+ ClientUILib.log(ClientUILogger.ERROR, "DOM Element with id " + id + "
not found for update.");
+ if(!src)
+ ClientUILib.log(ClientUILogger.ERROR, "RESPONSE Element with id " + id +
" not found for update.");
+ }
},
_clearAttributes : function(node) {
@@ -190,7 +198,6 @@
var baseid = clientid;
var rowsForUpdate = callbacks ? new Array(count) : null;
-
for(i=0; i<count; i++) {
rowindex = startRow + i;
if(rowindex >= rowCount){
@@ -198,7 +205,7 @@
}
[":f:", ":n:"].unbreakableEach(
function(suffix) {
- var id = baseid + suffix + rowindex;
+ var id = [baseid,suffix,rowindex].join("");
var row = Utils.DOM.replaceNode(id, request);
if (callbacks) {
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-21
11:38:04 UTC (rev 1247)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-21
11:41:43 UTC (rev 1248)
@@ -61,13 +61,14 @@
}.bind(this), 500);
}
},
-
onScrollComplete : function(request, event, data){
var options = this.dataModel.getCurrentOptions();
window.loadingServerTime = (new Date()).getTime();
Utils.AJAX.updateRows(options,request,this,this.client_id,
[this.updateSelectionCallBack]);
if (this.selectionManager) {
- this.selectionManager.restoreState();
+ setTimeout(function(){
+ this.selectionManager.restoreState();
+ }.bind(this), 500);
}
window.loadingEndTime = (new Date()).getTime();
Show replies by date