Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeating headers are not working properly #17239

Closed
kamil-tekiela opened this issue Dec 9, 2021 · 5 comments
Closed

Repeating headers are not working properly #17239

kamil-tekiela opened this issue Dec 9, 2021 · 5 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@kamil-tekiela
Copy link
Contributor

kamil-tekiela commented Dec 9, 2021

Describe the bug

phpMyAdmin has the functionality of repeating headers for results. By default only 25 results show per page and repeated headers are set to 100 so this functionality isn't used very often. However, when enabled the headers are not shown.

To Reproduce

Steps to reproduce the behavior:

  1. Execute SELECT
  2. Show more than 100 rows
  3. Scroll down to 100th row
  4. No repeated header

Expected behavior

There should be table header after every 100 rows.

Additional context

The problem is because of the following line in libraries/classes/Display/Results.php:

            // add repeating headers
            if (
                ($rowNumber != 0) && ($_SESSION['tmpval']['repeat_cells'] != 0)
                && ! $rowNumber % $_SESSION['tmpval']['repeat_cells']
            ) {
                $tableBodyHtml .= $this->getRepeatingHeaders($displayParams);
            }

The condition is always false and Psalm warns about it. The correct condition should be:

            // add repeating headers
            if (
-                ($rowNumber != 0) && ($_SESSION['tmpval']['repeat_cells'] != 0)
-                && ! $rowNumber % $_SESSION['tmpval']['repeat_cells']
+                ($rowNumber !== 0) && ($_SESSION['tmpval']['repeat_cells'] > 0)
+                && ($rowNumber % $_SESSION['tmpval']['repeat_cells']) === 0
            ) {
                $tableBodyHtml .= $this->getRepeatingHeaders($displayParams);
            }

I will fix this code, but as the proper fix demands changes to CSS/HTML I would like to keep this bug open.

kamil-tekiela added a commit to kamil-tekiela/phpmyadmin that referenced this issue Dec 12, 2021
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
kamil-tekiela added a commit to kamil-tekiela/phpmyadmin that referenced this issue Dec 12, 2021
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
kamil-tekiela added a commit to kamil-tekiela/phpmyadmin that referenced this issue Dec 26, 2021
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
kamil-tekiela added a commit to kamil-tekiela/phpmyadmin that referenced this issue Dec 26, 2021
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
@MauricioFauth
Copy link
Member

Closed by #17243

@MauricioFauth MauricioFauth added Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete labels Dec 27, 2021
@williamdes
Copy link
Member

Did this affect 5.1?

@williamdes
Copy link
Member

williamdes commented Feb 6, 2022

Did this affect 5.1?

Answer to myself: Yes, in 5.1 repeating headers do not work

@williamdes williamdes added this to the 5.1.3 milestone Feb 6, 2022
williamdes pushed a commit that referenced this issue Feb 6, 2022
Ref: 97810b3

igned-off-by: Kamil Tekiela <tekiela246@gmail.com>
williamdes added a commit that referenced this issue Feb 6, 2022
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Feb 6, 2022
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

Cherry-picked into 5.1 as b5a6729

williamdes pushed a commit that referenced this issue Feb 6, 2022
…hover are shown on each row

Ref: 97810b3

igned-off-by: Kamil Tekiela <tekiela246@gmail.com>
williamdes added a commit that referenced this issue Feb 6, 2022
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

Also e84e1bd to fix:
image

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

3 participants