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

Fix paginator when using translated 'all' option #833

Closed
mczudek00 opened this issue Oct 15, 2019 · 4 comments
Closed

Fix paginator when using translated 'all' option #833

mczudek00 opened this issue Oct 15, 2019 · 4 comments

Comments

@mczudek00
Copy link

Hi,

I found an issue when using translated 'all' option in items.

This code is searching for 'all' in values, but the value contains translated 'all' option so it resets the $per_page value.

if (($per_page !== 'all' && !in_array((int) $this->per_page, $items_per_page_list, true))
  || ($per_page === 'all' && !in_array($this->per_page, $items_per_page_list, true))) {
     $per_page = reset($items_per_page_list);
}

It could be fixed using key_exists instead of in_array.

if (($per_page !== 'all' && !key_exists((int) $this->per_page, $items_per_page_list))
  || ($per_page === 'all' && !key_exists($this->per_page, $items_per_page_list))) {
     $per_page = reset($items_per_page_list);
}

If this is acceptable fix then I would be glad if you put it in 5.x version as well.

Thank you

@xsuchy09
Copy link
Contributor

Last 5.7 version (for Nette < v3) - v5.7.2 - still has this issue. There are new commits fixing this issue - pls release new version for Nette < v3 too. Thanks.

@paveljanda
Copy link
Member

Could you please try branch v5.x? It should be fixed there. Thanks.

@xsuchy09
Copy link
Contributor

There is an error:
File: .../vendor/ublaboo/datagrid/src/DataGrid.php:2786
array_key_exists() expects exactly 2 parameters, 3 given
array_key_exists has only 2 parameters, not 3 ...

@xsuchy09
Copy link
Contributor

New issue #851, fix here #850 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants