| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview This implements a table header. | 6 * @fileoverview This implements a table header. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('cr.ui.table', function() { | 9 cr.define('cr.ui.table', function() { |
| 10 const TableSplitter = cr.ui.TableSplitter; | 10 const TableSplitter = cr.ui.TableSplitter; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 this.headerInner_.textContent = ''; | 57 this.headerInner_.textContent = ''; |
| 58 for (var i = 0; i < cm.size; i++) { | 58 for (var i = 0; i < cm.size; i++) { |
| 59 headerCells[i].style.width = cm.getWidth(i) + '%'; | 59 headerCells[i].style.width = cm.getWidth(i) + '%'; |
| 60 this.headerInner_.appendChild(headerCells[i]); | 60 this.headerInner_.appendChild(headerCells[i]); |
| 61 } | 61 } |
| 62 this.appendSplitters_(); | 62 this.appendSplitters_(); |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 batchCount_: 0, |
| 66 |
| 67 startBatchUpdates: function() { |
| 68 this.batchCount_++; |
| 69 }, |
| 70 |
| 71 endBatchUpdates: function() { |
| 72 this.batchCount_--; |
| 73 if (this.batchCount_ == 0) |
| 74 this.redraw(); |
| 75 }, |
| 76 |
| 65 /** | 77 /** |
| 66 * Redraws table header. | 78 * Redraws table header. |
| 67 */ | 79 */ |
| 68 redraw: function() { | 80 redraw: function() { |
| 81 if (this.batchCount_ != 0) |
| 82 return; |
| 83 |
| 69 var cm = this.table_.columnModel; | 84 var cm = this.table_.columnModel; |
| 70 var dm = this.table_.dataModel; | 85 var dm = this.table_.dataModel; |
| 71 | 86 |
| 72 this.updateWidth(); | 87 this.updateWidth(); |
| 73 this.headerInner_.textContent = ''; | 88 this.headerInner_.textContent = ''; |
| 74 | 89 |
| 75 if (!cm || ! dm) { | 90 if (!cm || ! dm) { |
| 76 return; | 91 return; |
| 77 } | 92 } |
| 78 | 93 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 /** | 170 /** |
| 156 * The table associated with the header. | 171 * The table associated with the header. |
| 157 * @type {cr.ui.Table} | 172 * @type {cr.ui.Table} |
| 158 */ | 173 */ |
| 159 cr.defineProperty(TableHeader, 'table'); | 174 cr.defineProperty(TableHeader, 'table'); |
| 160 | 175 |
| 161 return { | 176 return { |
| 162 TableHeader: TableHeader | 177 TableHeader: TableHeader |
| 163 }; | 178 }; |
| 164 }); | 179 }); |
| OLD | NEW |