Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: ui/webui/resources/js/cr/ui/table/table_column.js

Issue 1006003004: Adding a visibility property to cr.ui.table.TableColumn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback. Fix resize jank. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/table/table_column_model.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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}
*/
« no previous file with comments | « no previous file | ui/webui/resources/js/cr/ui/table/table_column_model.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698