Support swipe mode with persist first column option

Created on 2 April 2024, 8 months ago
Updated 29 July 2024, 4 months ago

Problem/motivation

According to https://filamentgroup.github.io/tablesaw/demo/swipe.html it is possible to have swipe mode and persistent first column. But the filter in this module adds data-tablesaw-priority attribute to all ths and therefor persist value for data-tablesaw-priority is not allowed to be set, see here src/Plugin/Filter/FilterResponsiveTablesFilter.php:


             // Add required columntoggle- & swipe- specific attributes.
              if (in_array($mode, ['columntoggle', 'swipe'])) {
                $th->setAttribute('data-tablesaw-sortable-col', '');
                if (!$th->getAttribute('data-tablesaw-priority')) {
                  $th->setAttribute('data-tablesaw-priority', $inc);
                  $inc++;
                }
              }
              // Add persistent first column if no priority has been specified.
              if ($persist && $delta === 0 && !$th->getAttribute('data-tablesaw-priority')) {
                $th->setAttribute('data-tablesaw-priority', 'persist');
              }

Steps to reproduce

  1. Create text format and enable responsive tables filter
  2. Select "Swipe mode"
  3. Enable persist option

In the mobile view the table will swipe, but the first column will not be "sticky" like in examples here https://filamentgroup.github.io/tablesaw/demo/swipe.html

Proposed resolution

Set 'data-tablesaw-priority' attribute to 'persist' for first column in "Swipe mode" if enabled in the text format.

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany a.dmitriiev

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024