Author: konstantin.mishin
Date: 2008-03-18 12:01:59 -0400 (Tue, 18 Mar 2008)
New Revision: 6915
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
RF-2038
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-03-18
15:51:27 UTC (rev 6914)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-03-18
16:01:59 UTC (rev 6915)
@@ -493,43 +493,30 @@
}
else if(options.switchType === 1 || options.switchType === 2) {
// store visible row pos to restore after rows reerrange
- var count = frozenTbl.rows.length;
- var frows = new Array(count), nrows = new Array(count);
+ var ncount = normalTbl.rows.length;
+ var fcount = frozenTbl.rows.length;
+ var frows = new Array(fcount), nrows = new Array(ncount);
var j = 0, i;
var index = options.index;
-
- if(options.switchType === 1) {
- for(i=options.count; i<this.rowsCount; i++) {
+ var count = options.count;
+ if(options.switchType === 2) {
+ count = this.rowsCount - count;
+ }
+ for(i=count; i<this.rowsCount; i++) {
+ if (fcount) {
frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- j++;
}
- for(i=0; i<options.count; i++) {
- frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- /*if(updateCash) {
- cash.setRow(index+i, {f: frows[j].innerHTML, n: nrows[j].innerHTML});
- }*/
- j++;
- }
+ nrows[j] = normalTbl.rows[i];
+ j++;
}
- else {
- for(i=this.rowsCount - options.count; i<this.rowsCount; i++) {
+ for(i=0; i<count; i++) {
+ if (fcount) {
frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- /*if(updateCash) {
- cash.setRow(index+j, {f: frows[j].innerHTML, n: nrows[j].innerHTML});
- }*/
- j++;
}
- for(i=0; i<this.rowsCount - options.count; i++) {
- frows[j] = frozenTbl.rows[i];
- nrows[j] = normalTbl.rows[i];
- j++;
- }
+ nrows[j] = normalTbl.rows[i];
+ j++;
}
-
// Mozilla is faster when doing the DOM manipulations on
// an orphaned element. MSIE is not
var removeChilds = navigator.product == "Gecko";
@@ -546,8 +533,10 @@
}
// insert in the new order
- for (i = 0; i < count; i++) {
- fbody.appendChild(frows[i]);
+ for (i = 0; i < ncount; i++) {
+ if (fcount) {
+ fbody.appendChild(frows[i]);
+ }
nbody.appendChild(nrows[i]);
}