Sha256: e8183b9220acd02e20c8e93caa73a486524244e99a9c1db38ad2220684fbd494

Contents?: true

Size: 817 Bytes

Versions: 468

Compression:

Stored size: 817 Bytes

Contents

import PbEnhancedElement from '../pb_enhanced_element'

export default class PbTable extends PbEnhancedElement {
  static get selector() {
    return '.table-responsive-collapse'
  }

  connect() {
    const tables = document.querySelectorAll('.table-responsive-collapse');

    // Each Table
    [].forEach.call(tables, (table) => {
      // Header Titles
      var headers = [].map.call(table.querySelectorAll('th'), (header) => {
        return header.textContent.replace(/\r?\n|\r/, '')
      });

      // for each row in tbody
      [].forEach.call(table.querySelectorAll('tbody tr'), (row) => {
        // for each cell
        [].forEach.call(row.cells, (cell, headerIndex) => {
          // apply the attribute
          cell.setAttribute('data-title', headers[headerIndex])
        })
      })
    })
  }
}

Version data entries

468 entries across 468 versions & 1 rubygems

Version Path
playbook_ui-4.11.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.10.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.9.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-4.8.2 app/pb_kits/playbook/pb_table/index.js