Author: konstantin.mishin
Date: 2007-08-02 12:32:19 -0400 (Thu, 02 Aug 2007)
New Revision: 2022
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
Log:
RF-297
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-08-02
16:29:00 UTC (rev 2021)
+++
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-08-02
16:32:19 UTC (rev 2022)
@@ -743,16 +743,23 @@
},
showRow: function(rowIndex) {
- var row = $(this.gridId + ":f:" + rowIndex);
- var offsetTop = this.fTable.offsetTop + row.offsetTop;
- if(this.frozenContentBox.getElement().scrollTop > offsetTop) {
- this.setScrollPos(offsetTop);
+ if(rowIndex == "up") {
+ this.scrollBox.getElement().scrollTop = this.scrollBox.getElement().scrollTop -
this.fTable.rows[1].offsetTop;
+ } else if(rowIndex == "down") {
+ this.scrollBox.getElement().scrollTop = this.scrollBox.getElement().scrollTop +
this.fTable.rows[1].offsetTop;
} else {
- offsetTop += row.offsetHeight;
- offsetTop -= this.frozenContentBox.getElement().clientHeight;
- if (this.frozenContentBox.getElement().scrollTop < offsetTop){
- this.setScrollPos(offsetTop);
+ var row = $(this.gridId + ":f:" + rowIndex);
+ var offsetTop = this.fTable.offsetTop + row.offsetTop;
+ if(this.frozenContentBox.getElement().scrollTop > offsetTop) {
+ this.scrollBox.getElement().scrollTop = offsetTop;
+ } else {
+ offsetTop += row.offsetHeight;
+ offsetTop -= this.frozenContentBox.getElement().clientHeight;
+ if (this.frozenContentBox.getElement().scrollTop < offsetTop){
+ this.scrollBox.getElement().scrollTop = offsetTop;
+ }
}
}
+ this.scrollBox.updateScrollPos();
}
});
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
---
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-08-02
16:29:00 UTC (rev 2021)
+++
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-08-02
16:32:19 UTC (rev 2022)
@@ -326,55 +326,56 @@
var range, rowIndex;
var activeRow = this.activeRow;
var noDefault = false;
+ this.firstIndex = Number($(this.prefix +
":f").rows[0].id.split(this.prefix)[1].split(":")[2]);;
switch (event.keyCode || event.charCode) {
case Event.KEY_UP:
- if (this.inFocus && activeRow) {
- if(activeRow) {
- rowIndex = activeRow - 1;
+ if (this.inFocus && activeRow != null) {
+ if(this.firstIndex != activeRow) {
+ rowIndex = (this.rowCount + activeRow - 1) % this.rowCount;
+ if (!event.ctrlKey && !event.shiftKey) {
+ this.selectionFlag = "x";
+ range = [rowIndex, rowIndex];
+ this.setSelection(range);
+ } else if (!event.ctrlKey && event.shiftKey) {
+ if(!this.shiftRow) {
+ this.shiftRow = this.activeRow;
+ }
+ if(this.shiftRow >= this.activeRow) {
+ this.addRowToSelection(rowIndex);
+ } else {
+ this.removeRowFromSelection(activeRow);
+ }
+ }
+ noDefault = true;
+ this.setActiveRow(rowIndex);
} else {
- rowIndex = this.rowCount - 1;
+ this.grid.getBody().showRow("up");
}
- if (!event.ctrlKey && !event.shiftKey) {
- this.selectionFlag = "x";
- range = [rowIndex, rowIndex];
- this.setSelection(range);
- } else if (!event.ctrlKey && event.shiftKey) {
- if(!this.shiftRow) {
- this.shiftRow = this.activeRow;
- }
- if(this.shiftRow >= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
- }
- noDefault = true;
- this.setActiveRow(rowIndex);
}
break;
case Event.KEY_DOWN:
if (this.inFocus && activeRow != null) {
- if(activeRow == this.rowCount - 1) {
- rowIndex = 0;
+ rowIndex = (activeRow + 1) % this.rowCount;
+ if(this.firstIndex != rowIndex) {
+ if (!event.ctrlKey && !event.shiftKey) {
+ this.selectionFlag = "x";
+ range = [rowIndex, rowIndex];
+ this.setSelection(range);
+ } else if (!event.ctrlKey && event.shiftKey) {
+ if(!this.shiftRow) {
+ this.shiftRow = this.activeRow;
+ }
+ if(this.shiftRow <= this.activeRow) {
+ this.addRowToSelection(rowIndex);
+ } else {
+ this.removeRowFromSelection(activeRow);
+ }
+ }
+ noDefault = true;
+ this.setActiveRow(rowIndex);
} else {
- rowIndex = activeRow + 1;
+ this.grid.getBody().showRow("down");
}
- if (!event.ctrlKey && !event.shiftKey) {
- this.selectionFlag = "x";
- range = [rowIndex, rowIndex];
- this.setSelection(range);
- } else if (!event.ctrlKey && event.shiftKey) {
- if(!this.shiftRow) {
- this.shiftRow = this.activeRow;
- }
- if(this.shiftRow <= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
- }
- noDefault = true;
- this.setActiveRow(rowIndex);
}
break;
case 65: case 97: // Ctrl-A
Show replies by date