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-10.26.0.pre.alpha.display1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.26.0.pre.alpha3 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.25.1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.26.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.25.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.24.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.23.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.22.1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.22.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.21.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_table/index.js
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_table/index.js