MCPcopy Create free account
hub / github.com/handsontable/handsontable / createTable

Method createTable

handsontable/src/utils/ghostTable.ts:478–507  ·  view source on GitHub ↗

* Create table element. * * @param {string} className The CSS classes to add. * @returns {object}

(className = '')

Source from the content-addressed store, hash-verified

476 * @returns {object}
477 */
478 createTable(className = ''): GhostTableStruct {
479 const rootDocument = this.hot!.rootDocument;
480 const fragment = rootDocument.createDocumentFragment();
481 const table = rootDocument.createElement('table');
482 const tHead = rootDocument.createElement('thead');
483 const tBody = rootDocument.createElement('tbody');
484 const colGroup = rootDocument.createElement('colgroup');
485 const tr = rootDocument.createElement('tr');
486 const th = rootDocument.createElement('th');
487
488 if (this.isVertical()) {
489 table.appendChild(colGroup);
490 }
491 if (this.isHorizontal()) {
492 tr.appendChild(th);
493 tHead.appendChild(tr);
494 table.style.tableLayout = 'auto';
495 table.style.width = 'auto';
496 }
497 table.appendChild(tHead);
498
499 if (this.isVertical()) {
500 tBody.appendChild(tr);
501 }
502 table.appendChild(tBody);
503 addClass(table, className);
504 fragment.appendChild(table);
505
506 return { fragment, table, tHead, tBody, colGroup, tr, th };
507 }
508
509 /**
510 * Create container for tables.

Callers 3

addRowMethod · 0.95
addColumnHeadersRowMethod · 0.95
addColumnMethod · 0.95

Calls 3

isVerticalMethod · 0.95
isHorizontalMethod · 0.95
addClassFunction · 0.90

Tested by

no test coverage detected