Skip to content
New issue

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

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

Already on GitHub? # to your account

colspan issue in ListOperation #4951

Closed
EGYWEB-Mohamed opened this issue Mar 1, 2023 · 17 comments
Closed

colspan issue in ListOperation #4951

EGYWEB-Mohamed opened this issue Mar 1, 2023 · 17 comments
Assignees
Labels
Possible Bug A bug that was reported but not confirmed yet.

Comments

@EGYWEB-Mohamed
Copy link
Contributor

Bug report

What I did

responsive table

What I expected to happen

image

What happened

image

and I noticed from inspect element there's colspan added to the first row

image

What I've already tried to fix it

N/A

Is it a bug in the latest version of Backpack?

Yes

Backpack, Laravel, PHP, DB version

PHP VERSION:

PHP 8.1.7 (cli) (built: Jun 16 2022 12:46:39) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.7, Copyright (c) Zend Technologies
with the ionCube PHP Loader v12.0.5, Copyright (c) 2002-2022, by ionCube Ltd.

LARAVEL VERSION:

v9.52.4@9239128cfb4d22afefb64060dfecf53e82987267

BACKPACK PACKAGE VERSIONS:

backpack/crud: 5.5.1
backpack/devtools: 1.3.2
backpack/editable-columns: 2.1.1
backpack/filemanager: 2.0.0
backpack/generators: 3.3.14
backpack/permissionmanager: 6.0.16
backpack/pro: 1.6.0

@tabacitu
Copy link
Member

tabacitu commented Mar 5, 2023

Hmm... I'm not sure I understand @EGYWEB-Mohamed . Can you please rephrase? Everywhere I have responsiveTable enabled... it works... there's no such visual bug like you showed in your screenshot. How did you do that? What did you do different - that's the part I don't understand.

Is it happening anywhere in our demo https://demo.backpackforlaravel.com/admin/article?

Cheers!

@tabacitu tabacitu self-assigned this Mar 5, 2023
@EGYWEB-Mohamed
Copy link
Contributor Author

@tabacitu after too many hours of investigation I found it causes when there are too many columns and responsiveTable => true in list.php and what is causing is showEntryCount => true when it is true the problem is fixed by itself
image

and when it changes to false, this weird problem appears
image

@tabacitu tabacitu added the Minor Bug A bug that happens only in a very niche or specific use case. label Mar 7, 2023
@tabacitu tabacitu moved this to Todo in Backpack v5.4+ Apr 29, 2023
@tabacitu tabacitu moved this to Todo in This week Apr 29, 2023
@karandatwani92
Copy link
Contributor

karandatwani92 commented May 1, 2023

Hi @jorgetwgroup
Following the above instructions I'm unable to reproduce this error. Neither I found anything in src related to colspan
Please have a look and let me know what you find then we fix it.

@karandatwani92 karandatwani92 moved this from Todo to In Progress in This week May 1, 2023
@karandatwani92 karandatwani92 moved this from Todo to In Progress in Backpack v5.4+ May 1, 2023
@adriannuta
Copy link

I can confirm this bug as well: it reproduces with showEntryCount=false and on small resolutions. It does not reproduce if responsive table is disabled. If if you redrawn the result (e.g. using no. of entries per page dropdown), it renders fine.

@mint-ws
Copy link

mint-ws commented May 19, 2023

I see this issue has been added to the Todo list but for what it's worth, I'm experiencing the exact same issue. First row gets a colspan on a responsive table.

showEntryCount = false:
image

showEntryCount = true:
image

I've also noticed the page number in the pagination links at the bottom of the table also does not show.

showEntryCount=false:
image

showEntryCount=true:
image

Huge thank you to @EGYWEB-Mohamed for figuring out the fix.

@EGYWEB-Mohamed
Copy link
Contributor Author

@mint-ws
You're welcome! I'm glad to hear that It's always great when people come together to help each other out.

@pxpm
Copy link
Contributor

pxpm commented Oct 11, 2023

Hey guys.

Thanks for the report and solution @EGYWEB-Mohamed and everyone who participated here.

I hope that we fixed this somehow 🤷 , I was totally unable to reproduce this in our demo:

image

image

I am preemptively closing this, but if you guys still experience the issue, please provide me the clear steps on how I can reproduce it, ideally in our demo, or in a clean install.

Cheers

@pxpm pxpm closed this as completed Oct 11, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Backpack v5.4+ Oct 11, 2023
@zeknoss
Copy link

zeknoss commented Mar 1, 2024

Hello,
I can also confirm that disabling the row count on the list view makes the first row of table render the first column with wrong colspan value.

@pxpm I believe you can reproduce this issue using the tabler theme.

@pxpm pxpm reopened this Mar 2, 2024
@pxpm pxpm added Possible Bug A bug that was reported but not confirmed yet. and removed triage Minor Bug A bug that happens only in a very niche or specific use case. labels Mar 2, 2024
@pxpm pxpm removed this from Backpack v5.4+ Mar 2, 2024
@pxpm pxpm assigned pxpm and unassigned karandatwani92 and jcastroa87 Mar 2, 2024
@K-Mazur
Copy link

K-Mazur commented May 9, 2024

Hi,

I can confirm that I've also encountered this bug. Not sure if that helps or not, but it appears that when we set showEntryCount to false, then in the ListOperation trait, the $totalEntryCount and $filteredEntryCount are set up differently, and once $filteredEntryCount is 0, the problem occurs.

// if show entry count is disabled we use the "simplePagination" technique to move between pages.
if ($this->crud->getOperationSetting('showEntryCount')) {
$totalEntryCount = (int) (request()->get('totalEntryCount') ?: $this->crud->getTotalQueryCount());
$filteredEntryCount = $this->crud->getFilteredQueryCount() ?? $totalEntryCount;
} else {
$totalEntryCount = $length;
$filteredEntryCount = $entries->count() < $length ? 0 : $length + $start + 1;
}

@pxpm
Copy link
Contributor

pxpm commented Aug 15, 2024

I've tried really hard to reproduce this again, but unfortunatelly I am still not able.

I've tried enable/disable showEntryCount, I've tried forcing the filteredEntryCount to be 0 as suggested by @K-Mazur, I've tried enabled and disabled responsive table, nothing yielded those results.

image
image
image

image
image
image

One thing I noticed from your screenshots is that the search bar on the top right has rounded borders, while we use for some time square borders. Is it possible that you guys have the list.blade.php and or datatables_logic.blade.php overwritten in your projects and are not loading the backpack view ?

I would really love to be able to reproduce this, if anyone can setup a reproduction repo I can use, I will glady fix this, until then I am totally in the dark here 😞

Going to keep this open for a while hoping someone can provide me a way to reproduce this.

Cheers

@mint-ws
Copy link

mint-ws commented Aug 16, 2024

Hi there, since I stopped using backpack some time ago I can't provide a sample.
I didn't override list.blade.php and or datatables_logic.blade.php but I do see from your screenshots that the page numbers in the pagination links (bottom right) still don't show when showEntryCount=false. If that's not intentional maybe therein lies a clue. Sorry I can't be more helpful.

@pxpm
Copy link
Contributor

pxpm commented Aug 16, 2024

Hi there, since I stopped using backpack some time ago I can't provide a sample. I didn't override list.blade.php and or datatables_logic.blade.php but I do see from your screenshots that the page numbers in the pagination links (bottom right) still don't show when showEntryCount=false. If that's not intentional maybe therein lies a clue. Sorry I can't be more helpful.

Thanks @mint-ws, appreciate your feedback. Not showing the page numbers when showEntryCount is false is a feature. To display the page numbers we would need to do the count to know how many pages of information there are so it would defeat the purpose of not doing the count on the first place.

Thanks a lot for your input, I will wait to see if someone else have a better insight 🙏

Cheers

@zeknoss
Copy link

zeknoss commented Aug 16, 2024

Hi there, since I stopped using backpack some time ago I can't provide a sample. I didn't override list.blade.php and or datatables_logic.blade.php but I do see from your screenshots that the page numbers in the pagination links (bottom right) still don't show when showEntryCount=false. If that's not intentional maybe therein lies a clue. Sorry I can't be more helpful.

Thanks @mint-ws, appreciate your feedback. Not showing the page numbers when showEntryCount is false is a feature. To display the page numbers we would need to do the count to know how many pages of information there are so it would defeat the purpose of not doing the count on the first place.

Thanks a lot for your input, I will wait to see if someone else have a better insight 🙏

Cheers

Hey @pxpm, which theme are you using in your tests?

@pxpm
Copy link
Contributor

pxpm commented Aug 16, 2024

@zeknoss screenshots are from tabler theme, but I also tested on coreui-v2.

@zeknoss
Copy link

zeknoss commented Aug 16, 2024

I'll try to come up with a reproduction guide for you, asap

@adriannuta
Copy link

Hi,

I can confirm that I've also encountered this bug. Not sure if that helps or not, but it appears that when we set showEntryCount to false, then in the ListOperation trait, the $totalEntryCount and $filteredEntryCount are set up differently, and once $filteredEntryCount is 0, the problem occurs.

// if show entry count is disabled we use the "simplePagination" technique to move between pages.
if ($this->crud->getOperationSetting('showEntryCount')) {
$totalEntryCount = (int) (request()->get('totalEntryCount') ?: $this->crud->getTotalQueryCount());
$filteredEntryCount = $this->crud->getFilteredQueryCount() ?? $totalEntryCount;
} else {
$totalEntryCount = $length;
$filteredEntryCount = $entries->count() < $length ? 0 : $length + $start + 1;
}

Setting $filteredEntryCount to 0 is the problem. If the result set has one row, the 'search' response will be "recordsTotal": 10, "recordsFiltered": 0, "actual_total": 1 - this cause that colspan (I think dt tries to draw the 'No results found' because of recordsFiltered value and the rows drawing doesn't clear that colspan). $filteredEntryCount should be set to $entries->count() instead.

@pxpm
Copy link
Contributor

pxpm commented Jan 8, 2025

thank you all, I was finally able to reproduce the issue and fix it 🙏

A composer update should give you 5.7.46 of backpack/crud with the fix 👍

Cheers

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Possible Bug A bug that was reported but not confirmed yet.
Projects
Status: Done
Development

No branches or pull requests

9 participants