Problem/Motivation

Tablefield creates tables with sticky header and currently it's not possible to disable those sticky headers.

Proposed resolution

Make it possible to pass 'sticky' property in variables of theme_tablefield_view() function. If 'sticky' is set, pass it along other variables for theme('table__tablefield').

After that, sticky table header can be disabled with:

function THEME_preprocess_tablefield_view(&$variables) {
  $variables['sticky'] = FALSE;
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ilkkave created an issue. See original summary.

ilkkave’s picture

Here's a patch to make this possible.

ilkkave’s picture

Status: Active » Needs review

Updating status.

lolandese’s picture

Version: 7.x-2.5 » 7.x-2.x-dev
FileSize
58.76 KB
1.7 KB

Added the option in the UI (see screenshot) so we don't need a theme hack.

Screenshot

SebasL’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
33.17 KB

Patch applies cleanly.

After applying the patch, the checkbox for the sticky header is present in the manage fields section*
After un-checking the sticky header option and clearing the Drupal cache, the header does not stick to the top of the parent element as expected. See image below:
screenshot
Also, when checking again the option, the header sticks to the top of the parent element on scroll as expected as well.

*Note: I understand why the setting was added in the manage fields section, as there are other settings related to the header, however it would make more sense to add it to manage display, because it is a display setting. For that maybe a new issue should be created.

  • lolandese committed 21b98d4 on 7.x-2.x authored by ilkkave
    Issue #2816395 by lolandese, ilkkave, SebasL: Make it possible to...
lolandese’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

lolandese’s picture

Based on the suggestion in the bottom of comment #5 we created a new issue at #2841782: Move display related settings from manage fields to manage display.

lolandese’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)
Parent issue: » #2189203: D8 port (from the existing 7.x-3.x to a new 8.x-3.x)

For D8 also create the sticky header (currently not the case), additionally making it optional.