Sha256: d3e2c233709d4b09568e032a7dd9d15e7812d06be206dda7d8432f5f465e18f5

Contents?: true

Size: 926 Bytes

Versions: 10

Compression:

Stored size: 926 Bytes

Contents

export const addDataTitle = () => {
    const tables = document.querySelectorAll('.table-responsive-collapse');
    // Each Table
    [].forEach.call(tables, (table: HTMLTableElement) => {
        // Header Titles
        const headers: string[] = [];
        [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
            const colSpan = header.colSpan
            for (let i = 0; i < colSpan; i++) {
                headers.push(header.textContent.replace(/\r?\n|\r/, ''));
            }
        });
        // for each row in tbody
        [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
            // for each cell
            [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
                // apply the attribute
                cell.setAttribute('data-title', headers[headerIndex])
            })
        })
    });
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts