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 is a table column model | 6 * @fileoverview This is a table column model |
7 */ | 7 */ |
8 cr.define('cr.ui.table', function() { | 8 cr.define('cr.ui.table', function() { |
9 const EventTarget = cr.EventTarget; | 9 const EventTarget = cr.EventTarget; |
10 const Event = cr.Event; | 10 const Event = cr.Event; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (index < 0 || index >= this.columns_.size - 1) | 125 if (index < 0 || index >= this.columns_.size - 1) |
126 return; | 126 return; |
127 if (renderFunction !== this.columns_[index].renderFunction) | 127 if (renderFunction !== this.columns_[index].renderFunction) |
128 return; | 128 return; |
129 | 129 |
130 this.columns_[index].renderFunction = renderFunction; | 130 this.columns_[index].renderFunction = renderFunction; |
131 cr.dispatchSimpleEvent(this, 'change'); | 131 cr.dispatchSimpleEvent(this, 'change'); |
132 }, | 132 }, |
133 | 133 |
134 /** | 134 /** |
| 135 * Render the column header. |
| 136 * @param {number} index The index of the column. |
| 137 * @param {cr.ui.Table} Owner table. |
| 138 */ |
| 139 renderHeader: function(index, table) { |
| 140 var c = this.columns_[index]; |
| 141 return c.headerRenderFunction.call(c, table); |
| 142 }, |
| 143 |
| 144 /** |
135 * The total width of the columns. | 145 * The total width of the columns. |
136 * @type {number} | 146 * @type {number} |
137 */ | 147 */ |
138 get totalWidth() { | 148 get totalWidth() { |
139 return this.totalWidth_; | 149 return this.totalWidth_; |
140 }, | 150 }, |
141 | 151 |
142 /** | 152 /** |
143 * Normalizes widths to make their sum 100%. | 153 * Normalizes widths to make their sum 100%. |
144 */ | 154 */ |
(...skipping 18 matching lines...) Expand all Loading... |
163 return i; | 173 return i; |
164 } | 174 } |
165 return -1; | 175 return -1; |
166 }, | 176 }, |
167 }; | 177 }; |
168 | 178 |
169 return { | 179 return { |
170 TableColumnModel: TableColumnModel | 180 TableColumnModel: TableColumnModel |
171 }; | 181 }; |
172 }); | 182 }); |
OLD | NEW |