| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 this.headerInner_.textContent = ''; | 73 this.headerInner_.textContent = ''; |
| 74 | 74 |
| 75 if (!cm || ! dm) { | 75 if (!cm || ! dm) { |
| 76 return; | 76 return; |
| 77 } | 77 } |
| 78 | 78 |
| 79 for (var i = 0; i < cm.size; i++) { | 79 for (var i = 0; i < cm.size; i++) { |
| 80 var cell = this.ownerDocument.createElement('div'); | 80 var cell = this.ownerDocument.createElement('div'); |
| 81 cell.style.width = cm.getWidth(i) + '%'; | 81 cell.style.width = cm.getWidth(i) + '%'; |
| 82 cell.className = 'table-header-cell'; | 82 cell.className = 'table-header-cell'; |
| 83 cell.addEventListener('click', this.createSortFunction_(i).bind(this)); | 83 if (dm.isSortable(cm.getId(i))) |
| 84 cell.addEventListener('click', |
| 85 this.createSortFunction_(i).bind(this)); |
| 84 | 86 |
| 85 cell.appendChild(this.createHeaderLabel_(i)); | 87 cell.appendChild(this.createHeaderLabel_(i)); |
| 86 this.headerInner_.appendChild(cell); | 88 this.headerInner_.appendChild(cell); |
| 87 } | 89 } |
| 88 this.appendSplitters_(); | 90 this.appendSplitters_(); |
| 89 }, | 91 }, |
| 90 | 92 |
| 91 /** | 93 /** |
| 92 * Appends column splitters to the table header. | 94 * Appends column splitters to the table header. |
| 93 */ | 95 */ |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 /** | 160 /** |
| 159 * The table associated with the header. | 161 * The table associated with the header. |
| 160 * @type {cr.ui.Table} | 162 * @type {cr.ui.Table} |
| 161 */ | 163 */ |
| 162 cr.defineProperty(TableHeader, 'table'); | 164 cr.defineProperty(TableHeader, 'table'); |
| 163 | 165 |
| 164 return { | 166 return { |
| 165 TableHeader: TableHeader | 167 TableHeader: TableHeader |
| 166 }; | 168 }; |
| 167 }); | 169 }); |
| OLD | NEW |