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.12.1.pre.alpha.passphrase1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.12.1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.13.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.12.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0.pre.alpha.paginate2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0.pre.alpha.dialog2 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0.pre.alpha.paginate1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0.pre.alpha.renderer1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0.pre.alpha.dialog1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.11.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.10.0.pre.alpha.pre.bold1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.10.0.pre.alpha.pagination1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.10.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.9.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.9.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.8.1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.8.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.7.0.pre.alpha.table1 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.7.0 app/pb_kits/playbook/pb_table/index.js
playbook_ui-11.6.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_table/index.js