I needed an easy way to enable TableTools when displaying tables with theme_datatable().
You have to apply the patch attached in the issue: (#1029592: Cannot unset string offsets) to be able to use this.

Comments

dtengeri’s picture

StatusFileSize
new2.66 KB

You have to set bTableTools => TRUE in the datatable_options section of the attributes array to turn on TableTools.

  $attributes = array(
    'datatable_options' => array(
      'bFilter'   => TRUE, // Disable filtering of data.
      'bInfo'     => TRUE, // Show the table information display.
      'bTableTools' => TRUE,
    )
  );
  $content['table'] = array(
    '#theme' => 'datatable',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => $attributes,
  );
micnap’s picture

StatusFileSize
new2.88 KB

Some of the paths to the css and js files have changed since this patch was made. I've revised it and also set the bTableTools to TRUE so it doesn't need to be done separately.

So to get TableTools working once you have DataTables working, all you should need to do is apply this patch.

Mickey

duellj’s picture

Status: Active » Fixed

Thanks for the patches. Committed (with modifications) to 7.x branch

7wonders’s picture

I have tried enabling tabletools but nothing shows up on my view. I have tabletools at all/libraries/datatables/extras/TableTools/

Is this right?

7wonders’s picture

Figured it out. Was using libraries instead of module path.

duellj’s picture

Status: Fixed » Needs work

Ahh, good catch. The patch was assuming library existed in module path, not libraries. Needs some work to account for libraries.

duellj’s picture

Status: Needs work » Fixed

Fixed issue when datatables is in libraries path

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xaxan’s picture

Works fine!!

  • duellj committed 9ee6a35 on 7.x-1.x, 7.x-2.x
    Issue #1029798 by dtengeri, duellj, micnap - Adds TableTools plugin...
  • duellj committed 4fdfc43 on 7.x-1.x, 7.x-2.x
    Issue #1029798 - Fixes TableTools integration when plugin is in...