[richfaces-svn-commits] JBoss Rich Faces SVN: r4445 - trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Dec 4 10:08:48 EST 2007
Author: konstantin.mishin
Date: 2007-12-04 10:08:48 -0500 (Tue, 04 Dec 2007)
New Revision: 4445
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
Log:
PS-124
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-12-04 14:47:57 UTC (rev 4444)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-12-04 15:08:48 UTC (rev 4445)
@@ -339,81 +339,83 @@
},
processKeyDown: function(event) {
- if(!event.shiftKey) {
- this.shiftRow = null;
- }
- var range, rowIndex;
- var activeRow = this.activeRow;
- var noDefault = false;
- this.firstIndex = Number($(this.prefix + ":n").rows[0].id.split(this.prefix)[1].split(":")[2]);;
- switch (event.keyCode || event.charCode) {
- case Event.KEY_UP:
- 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.prefix + ":n").rows.length > 0) {
+ if(!event.shiftKey) {
+ this.shiftRow = null;
+ }
+ var range, rowIndex;
+ var activeRow = this.activeRow;
+ var noDefault = false;
+ this.firstIndex = Number($(this.prefix + ":n").rows[0].id.split(this.prefix)[1].split(":")[2]);;
+ switch (event.keyCode || event.charCode) {
+ case Event.KEY_UP:
+ 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);
+ }
}
- if(this.shiftRow >= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
+ noDefault = true;
+ this.setActiveRow(rowIndex);
+ } else {
+ this.grid.getBody().showRow("up");
}
- noDefault = true;
- this.setActiveRow(rowIndex);
- } else {
- this.grid.getBody().showRow("up");
}
- }
- break;
- case Event.KEY_DOWN:
- if (this.inFocus && activeRow != null) {
- 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;
+ break;
+ case Event.KEY_DOWN:
+ if (this.inFocus && activeRow != null) {
+ 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);
+ }
}
- if(this.shiftRow <= this.activeRow) {
- this.addRowToSelection(rowIndex);
- } else {
- this.removeRowFromSelection(activeRow);
- }
+ noDefault = true;
+ this.setActiveRow(rowIndex);
+ } else {
+ this.grid.getBody().showRow("down");
}
+ }
+ break;
+ case 65: case 97: // Ctrl-A
+ if (this.inFocus && event.ctrlKey) {
+ this.selectionFlag = "a";
+ range = [0, this.rowCount];
+ this.setSelection(range);
noDefault = true;
- this.setActiveRow(rowIndex);
- } else {
- this.grid.getBody().showRow("down");
}
- }
- break;
- case 65: case 97: // Ctrl-A
- if (this.inFocus && event.ctrlKey) {
- this.selectionFlag = "a";
- range = [0, this.rowCount];
- this.setSelection(range);
- noDefault = true;
- }
- break;
- case Event.KEY_TAB:
- this.lostFocus();
+ break;
+ case Event.KEY_TAB:
+ this.lostFocus();
+ }
+ if (noDefault) {
+ this.grid.getBody().showRow(this.activeRow);
+ this.selectionChanged(event);
+ if (event.preventBubble) event.preventBubble();
+ Event.stop(event);
+ }
}
- if (noDefault) {
- this.grid.getBody().showRow(this.activeRow);
- this.selectionChanged(event);
- if (event.preventBubble) event.preventBubble();
- Event.stop(event);
- }
},
processClick: function(event, rowIndex) {
More information about the richfaces-svn-commits
mailing list