| Index: ui/webui/resources/js/cr/ui/table/table_column.js
|
| diff --git a/ui/webui/resources/js/cr/ui/table/table_column.js b/ui/webui/resources/js/cr/ui/table/table_column.js
|
| index 193ca8675a35baa82bf6079fc69d06d20b7a700c..66f77ec1b7488faaf3fa1d9530092d9900daf643 100644
|
| --- a/ui/webui/resources/js/cr/ui/table/table_column.js
|
| +++ b/ui/webui/resources/js/cr/ui/table/table_column.js
|
| @@ -23,6 +23,7 @@ cr.define('cr.ui.table', function() {
|
| this.name_ = name;
|
| this.width_ = width;
|
| this.endAlign_ = !!opt_endAlign;
|
| + this.visible_ = true;
|
| }
|
|
|
| TableColumn.prototype = {
|
| @@ -40,6 +41,9 @@ cr.define('cr.ui.table', function() {
|
| tableColumn.renderFunction = this.renderFunction_;
|
| tableColumn.headerRenderFunction = this.headerRenderFunction_;
|
| tableColumn.defaultOrder = this.defaultOrder_;
|
| +
|
| + tableColumn.visible_ = this.visible_;
|
| +
|
| return tableColumn;
|
| },
|
|
|
| @@ -54,6 +58,7 @@ cr.define('cr.ui.table', function() {
|
| var div = /** @type {HTMLElement} */
|
| (table.ownerDocument.createElement('div'));
|
| div.textContent = dataItem[columnId];
|
| + div.hidden = !this.visible;
|
| return div;
|
| },
|
|
|
| @@ -65,6 +70,23 @@ cr.define('cr.ui.table', function() {
|
| headerRenderFunction_: function(table) {
|
| return table.ownerDocument.createTextNode(this.name);
|
| },
|
| +
|
| + /**
|
| + * The width of the column. Hidden columns have zero width.
|
| + * @type {number}
|
| + */
|
| + get width() {
|
| + return this.visible_ ? this.width_ : 0;
|
| + },
|
| +
|
| + /**
|
| + * The width of the column, disregarding visibility. For hidden columns,
|
| + * this would be the width of the column if it were to be made visible.
|
| + * @type {number}
|
| + */
|
| + get absoluteWidth() {
|
| + return this.width_;
|
| + },
|
| };
|
|
|
| /**
|
| @@ -86,6 +108,12 @@ cr.define('cr.ui.table', function() {
|
| cr.defineProperty(TableColumn, 'width');
|
|
|
| /**
|
| + * The column visibility.
|
| + * @type {boolean}
|
| + */
|
| + cr.defineProperty(TableColumn, 'visible');
|
| +
|
| + /**
|
| * True if the column is aligned to end.
|
| * @type {boolean}
|
| */
|
|
|