datagrid icon indicating copy to clipboard operation
datagrid copied to clipboard

Part of the state is lost after calling `setRememberState(false)` and then changing a per page limit from the UI

Open Tharos opened this issue 4 years ago • 5 comments

How to reproduce the bug:

  1. Install contributte playground

  2. Add a $grid->setRememberState(false) call into the BasicPresenter

  3. Go to the default view and write down da into the Name filter input

  4. That gives you 54 results, as expected

  5. But then change the pagination to 50 items per page

Suddenly you get an unfiltered result (showing all 1000 records) but with the da still in the Name filter input.

Expected behavior would be not loosing the filter state (keeping it in URL) when the user changes items per page parameter.

Tharos avatar Apr 20 '21 12:04 Tharos

Could you send a PR? Thanks!

paveljanda avatar Apr 20 '21 12:04 paveljanda

I have some stupid workaround. As datagrid on paging change ignores filter values, I changed action attribute of grid form:

$(document).on('change', 'select[data-autosubmit-per-page]', function () {
    return $("#frm-grid-filter").attr("action",location.href);
}) 

I use this javascipt before loading ublaboo-datagrid/datagrid.js

This works for me with this settings:

      $grid->setRememberState(false);
      $grid->setRefreshUrl(true);
      $grid->setAutoSubmit(true);

TumaMilan avatar May 04 '21 15:05 TumaMilan

I have the same issue here (filters lost after pagination change) even though I am not using $grid->setRememberState(false). The workaround unfortunately didn't help.

I was trying to find out the root of the problem but still don't know why this is happening. I figured out that the problem occurs when I set setFilterDateRange() filter on some column.

arwin009 avatar May 29 '21 17:05 arwin009

I have the same issue. I am using this configuration.

$this->setStrictSessionFilterValues(false); $this->setRememberState(true); $this->setRefreshUrl(false); $this->setAutoSubmit(false);

Same as @arwin009, problem only occours with combination in setFilterDateRange()

Domm98CZ avatar Jun 04 '21 14:06 Domm98CZ

bump

Domm98CZ avatar Jun 21 '21 14:06 Domm98CZ