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-11.5.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.7.0.pre.alpha.pre.guagechart1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.6.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.5.0.pre.alpha.datepicker1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.6.0.pre.alpha.rubocopperf1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.6.1.pre.alpha.rubocop.pre.performance1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.5.0.pre.alpha.pre.rubocop app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.6.0.pre.alpha.momenttz1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.5.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.4.0.pre.alpha.rubytheme2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.4.0.pre.alpha.rubytheme1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.4.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.3.0.pre.alpha2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.3.0.pre.alpha1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.3.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.2.7 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.2.6 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.2.5 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.2.4 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_table/index.js