| Index: ui/webui/resources/js/cr/ui/table/table_list.js
|
| diff --git a/ui/webui/resources/js/cr/ui/table/table_list.js b/ui/webui/resources/js/cr/ui/table/table_list.js
|
| index df39c0ec73d1e0047facbb051da3f174ec3b68cc..665dd017d8515c968ab274d1154c5ceb72dfd1fe 100644
|
| --- a/ui/webui/resources/js/cr/ui/table/table_list.js
|
| +++ b/ui/webui/resources/js/cr/ui/table/table_list.js
|
| @@ -35,6 +35,10 @@ cr.define('cr.ui.table', function() {
|
| * Resizes columns. Called when column width changed.
|
| */
|
| resize: function() {
|
| + if (this.needsFullRedraw_()) {
|
| + this.redraw();
|
| + return;
|
| + }
|
| if (this.updateScrollbars_())
|
| List.prototype.redraw.call(this); // Redraw items only.
|
| this.resizeCells_();
|
| @@ -174,6 +178,7 @@ cr.define('cr.ui.table', function() {
|
| cell.className = 'table-row-cell';
|
| if (cm.isEndAlign(i))
|
| cell.style.textAlign = 'end';
|
| + cell.hidden = !cm.isVisible(i);
|
| cell.appendChild(
|
| cm.getRenderFunction(i).call(null, dataItem, cm.getId(i), table));
|
|
|
| @@ -183,6 +188,25 @@ cr.define('cr.ui.table', function() {
|
|
|
| return listItem;
|
| },
|
| +
|
| + /**
|
| + * Determines whether a full redraw is required.
|
| + * @return {boolean}
|
| + */
|
| + needsFullRedraw_: function() {
|
| + var cm = this.table_.columnModel;
|
| + var row = this.firstElementChild;
|
| + // If the number of columns in the model has changed, a full redraw is
|
| + // needed.
|
| + if (row.children.length != cm.size)
|
| + return true;
|
| + // If the column visibility has changed, a full redraw is required.
|
| + for (var i = 0; i < cm.size; ++i) {
|
| + if (cm.isVisible(i) == row.children[i].hidden)
|
| + return true;
|
| + }
|
| + return false;
|
| + },
|
| };
|
|
|
| /**
|
|
|