Author: konstantin.mishin
Date: 2007-06-25 07:26:58 -0400 (Mon, 25 Jun 2007)
New Revision: 1290
Modified:
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
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Log:
add column hide JS API
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-25
11:26:15 UTC (rev 1289)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-25
11:26:58 UTC (rev 1290)
@@ -753,5 +753,17 @@
},
_getRowIndex: function(rowId) {
return Number(rowId.split(this.grid.getElement().id)[1].split(":")[2]);
+ },
+
+ hideColumn: function(index, frozen) {
+ var rows;
+ if(frozen) {
+ rows = this.templFrozen.getElement().rows;
+ } else {
+ rows = this.templNormal.getElement().rows;
+ }
+ for(var i=0; i<rows.length; i++) {
+ rows[i].removeChild(rows[i].cells[index]);
+ }
}
});
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-25
11:26:15 UTC (rev 1289)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-25
11:26:58 UTC (rev 1290)
@@ -177,5 +177,17 @@
width = 1;
}
columns.last().footerCol.width = width;
+ },
+
+ hideColumn: function(index, frozen) {
+ var rows;
+ if(frozen) {
+ rows = this.headerFrozenRow.getElement().rows;
+ } else {
+ rows = this.headerRow.getElement().rows;
+ }
+ for(var i=0; i<rows.length; i++) {
+ rows[i].removeChild(rows[i].cells[index]);
+ }
}
});
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-25
11:26:15 UTC (rev 1289)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-25
11:26:58 UTC (rev 1290)
@@ -426,5 +426,21 @@
width = 1;
}
this._columns.last().col.width = width;
+ },
+
+ hideColumn: function(index, frozen) {
+ var colomn = this._columns.splice(index,1)[0];
+ colomn.col.parentNode.removeChild(colomn.col);
+ colomn.bodyCol.parentNode.removeChild(colomn.bodyCol);
+ colomn.footerCol.parentNode.removeChild(colomn.footerCol);
+ var rows;
+ if(frozen) {
+ rows = this.headerFrozenRow.getElement().rows;
+ } else {
+ rows = this.headerRow.getElement().rows;
+ }
+ for(var i=0; i<rows.length; i++) {
+ rows[i].removeChild(rows[i].cells[index]);
+ }
}
});
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-25
11:26:15 UTC (rev 1289)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-06-25
11:26:58 UTC (rev 1290)
@@ -117,10 +117,25 @@
this.updateLayout();
},
- doExpand: function(index) {
+ doCollapse: function(index) {
+ var header = this.getHeader();
+ var length = header.headerFrozenRow.getElement().rows[0].cells.length;
+ if(index < length) {
+ this.hideColumn(index, true);
+ } else {
+ index -= fcount;
+ length = header.headerRow.getElement().rows[0].cells.length;
+ if (index < length - 1){
+ this.hideColumn(index, false);
+ }
+ }
},
- doCollapse: function(index) {
+ hideColumn: function(index, frozen) {
+ this.getHeader().hideColumn(index, frozen);
+ this.getBody().hideColumn(index, frozen);
+ if(this.getFooter()) {this.getFooter().hideColumn(index, frozen);}
+ this.updateLayout();
}
});
Show replies by date