Support for tableselect

Created on 15 September 2014, about 10 years ago
Updated 17 January 2024, 10 months ago

Hi,

I am using tableselect and I wanted to add datatables to it. I was able to do it by manually adding the library and javascript and it worked. Here is the code:

  if (!empty($options)) {
    $datatable_options = array(
      'bFilter' => TRUE,
      'bInfo' => TRUE,
      'iDisplayLength' => 500,
      'bPaginate' => FALSE,
    );
    drupal_add_library('datatables', 'datatables');
    drupal_add_js(array('datatables' => array('#tableselect-id' => $datatable_options)), 'setting');
  }

  $form['tableselect'] = array(
    '#type' => 'tableselect',
    '#header' => $headers,
    '#options' => $options,
    '#empty' => t('No records.'),
    '#attributes' => array(
      'id' => 'tableselect-id',
    ),
  );

I think in the module one could adjust theme_datatable or add a new function that supports tableselect. The main difference between theme_table and theme_tableselect is instead of #rows, #options is used.

Daniel

✨ Feature request
Status

Closed: outdated

Version

1.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dmundra Eugene, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024