The module states that leaving the first row of the table blank will stop the table from printing the header. This is untrue and the header is still printed but with blank cells. This is bad markup.

Solution:
At line 198 of tablefield.module change the code from:

 // Pull the header for theming
      $header = array_shift($tabledata);

      // Theme the table for display
      $element[$delta]['#markup'] = theme('tablefield_view', array('header' => $header, 'rows' => $tabledata, 'delta' => $delta));

to:

 // Pull the header for theming
      $header = array_shift($tabledata);
      if ((!empty ($header['0']['data'])) || (!empty ($header['1']['data']))) {
        $element[$delta]['#markup'] = theme('tablefield_view', array('header' => $header, 'rows' => $tabledata, 'delta' => $delta));
      } else {
        $element[$delta]['#markup'] = theme('tablefield_view', array('header' => NULL, 'rows' => $tabledata, 'delta' => $delta));
      }

This checks if the first two cells are empty and if so sets the table header to NULL.

Comments

moss.dev’s picture

Note: I am not the best coder in the world and there could be a better way of doing this. If anyone else has a better solution please chip in.

Thanks

jenlampton’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This is a very old issue, and I cannot reproduce it today. If the problem persists please reopen.