Author: dmorozov
Date: 2007-06-21 12:53:39 -0400 (Thu, 21 Jun 2007)
New Revision: 1264
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
Add Quick find in column functionality (only for currently loaded rows)
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-21
16:33:52 UTC (rev 1263)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-21
16:53:39 UTC (rev 1264)
@@ -173,14 +173,15 @@
setProgressCtrl: function(ctrl) {
this.getBody().setProgressCtrl(ctrl);
},
- quickFind: function(column, text) {
+ quickFind: function(column, text, startRow) {
+ var start = startRow || 0;
var searchText = "*" + text + "*";
searchText = searchText.replace(/\*/g, ".*");
var searchReg = new RegExp(searchText, 'i');
var rowIndex = -1;
var body = this.getBody();
var rowsCount = body.rowsCount;
- for (var i = 0; i < rowsCount; i++) {
+ for (var i = start; i < rowsCount; i++) {
var currentTextInGrid = body.getCellText(i, column);
currentTextInGrid = currentTextInGrid.replace(/,/g,'');
if (currentTextInGrid.search(searchReg) != -1) {
@@ -189,14 +190,14 @@
}
}
- return rowIndex>=0 ? (body.currRange.start+rowIndex) : -1;
+ return rowIndex;
},
ensureVisible: function(index) {
this.getBody().ensureVisible(index);
},
- convertRowIndex: function(index) {
+ getDataIndex: function(rowIndex) {
var body = this.getBody();
- return (index>(body.currRange.start+body.rowsCount)) ? (body.currRange.start -
body.currRange.start) : -1;
+ return this.getBody().currRange.start+rowIndex;
},
hideColumn: function(column) {
this.adjustColumnWidth(column, 0);
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-21
16:33:52 UTC (rev 1263)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-21
16:53:39 UTC (rev 1264)
@@ -740,9 +740,14 @@
},
ensureVisible: function (index) {
if(index>=0 && index<this.grid.dataModel.getCount()) {
- var y = index*this.defaultRowHeight;
- this.currentPos = 0;
- this._onContentVScroll(y);
+
+ var visibleRows = parseInt(this.contentBox.getHeight() / this.defaultRowHeight, 10) +
1;
+ if(this.grid.dataModel.getCount() > visibleRows) {
+ var y = index*this.defaultRowHeight;
+ this.currentPos = 0;
+ this._onContentVScroll(y);
+ this.scrollBox.getElement().scrollTop = y;
+ }
}
},
_getRowIndex: function(rowId) {
Show replies by date