* Create table row element. * * @param {number} row Visual row index. * @returns {DocumentFragment} Returns created table row elements.
(row: number)
| 309 | * @returns {DocumentFragment} Returns created table row elements. |
| 310 | */ |
| 311 | createRow(row: number) { |
| 312 | const rootDocument = this.hot!.rootDocument; |
| 313 | const fragment = rootDocument.createDocumentFragment(); |
| 314 | const th = rootDocument.createElement('th'); |
| 315 | |
| 316 | if (this.hot!.hasRowHeaders()) { |
| 317 | this.hot!.view.appendRowHeader(row, th); |
| 318 | |
| 319 | fragment.appendChild(th); |
| 320 | } |
| 321 | |
| 322 | this.samples!.forEach((sample: SampleEntry) => { |
| 323 | arrayEach(sample.strings, (string: SampleString) => { |
| 324 | const column = string.col!; |
| 325 | const cellProperties = this.hot!.getCellMeta<CellProperties>(row, column); |
| 326 | const renderer = this.hot!.getCellRenderer(cellProperties); |
| 327 | const td = rootDocument.createElement('td'); |
| 328 | |
| 329 | // Indicate that this element is created and supported by GhostTable. It can be useful to |
| 330 | // exclude rendering performance costly logic or exclude logic which doesn't work within a hidden table. |
| 331 | td.setAttribute('ghost-table', '1'); |
| 332 | renderer(this.hot!, td, row, column, this.hot!.colToProp(column), string.value, cellProperties); |
| 333 | fragment.appendChild(td); |
| 334 | }); |
| 335 | }); |
| 336 | |
| 337 | return fragment; |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Creates DOM elements for headers and appends them to the THEAD element of the table. |
no test coverage detected