Author: dmorozov
Date: 2007-06-21 12:13:34 -0400 (Thu, 21 Jun 2007)
New Revision: 1262
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
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
Log:
Draft "Hide column" functionality
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:05:45 UTC (rev 1261)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-21
16:13:34 UTC (rev 1262)
@@ -172,6 +172,34 @@
},
setProgressCtrl: function(ctrl) {
this.getBody().setProgressCtrl(ctrl);
+ },
+ quickFind: function(column, text) {
+ 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++) {
+ var currentTextInGrid = body.getCellText(i, column);
+ currentTextInGrid = currentTextInGrid.replace(/,/g,'');
+ if (currentTextInGrid.search(searchReg) != -1) {
+ rowIndex = i;
+ break;
+ }
+ }
+
+ return rowIndex>=0 ? (body.currRange.start+rowIndex) : -1;
+ },
+ ensureVisible: function(index) {
+ this.getBody().ensureVisible(index);
+ },
+ convertRowIndex: function(index) {
+ var body = this.getBody();
+ return (index>(body.currRange.start+body.rowsCount)) ? (body.currRange.start -
body.currRange.start) : -1;
+ },
+ 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:05:45 UTC (rev 1261)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-21
16:13:34 UTC (rev 1262)
@@ -351,7 +351,7 @@
},
adjustColumnWidth: function(column, width) {
var columns = this.grid.getHeader().getColumns();
- columns[column].bodyCol.width = width;
+ columns[column].bodyCol.width = width>0 ? width : 1;
},
setFakeColumnWidth: function() {
@@ -726,6 +726,25 @@
return options;
},
+ getCellText: function(row, column) {
+ var tbl = this.templFrozen.getElement().rows[row].cells;
+ var fcount = tbl.length;
+ var index = column;
+ if(index >= fcount) {
+ index -= fcount;
+ tbl = this.templNormal.getElement().rows[row].cells;
+ }
+
+ var cell = document.getElementsByClassName("ClientUI_Grid_BCBody",
tbl[index]);
+ return (cell && cell.length && cell.length>0) ? cell[0].innerHTML :
"";
+ },
+ ensureVisible: function (index) {
+ if(index>=0 && index<this.grid.dataModel.getCount()) {
+ var y = index*this.defaultRowHeight;
+ this.currentPos = 0;
+ this._onContentVScroll(y);
+ }
+ },
_getRowIndex: function(rowId) {
return Number(rowId.split(this.grid.getElement().id)[1].split(":")[2]);
}
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-21
16:05:45 UTC (rev 1261)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-21
16:13:34 UTC (rev 1262)
@@ -166,7 +166,7 @@
},
adjustColumnWidth: function(column, width) {
var columns = this.grid.getHeader().getColumns();
- columns[column].footerCol.width = width;
+ columns[column].footerCol.width = width>0 ? width : 1;
},
setFakeColumnWidth: function() {
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-21
16:05:45 UTC (rev 1261)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-21
16:13:34 UTC (rev 1262)
@@ -413,7 +413,8 @@
}
},
adjustColumnWidth: function(column, width) {
- this._columns[column].col.width = width;
+ this._columns[column].col.width = width>0 ? width : 1;
+ if(width<=0) this.getColumns()[column].sep.hide();
this._columns[column].width = width;
this.agjustSeparators();
},
Show replies by date