APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
492 stars 344 forks source link

Pagination and ajax bug #1012

Open vialcollet opened 6 years ago

vialcollet commented 6 years ago

Hi there I have a weird case with my Pagerfanta pagination. Here are two cases:

Case 1: directly switch to another page The request doesn't appear as an ajax call and therefore my entire page is reloaded.

$request = Request::createFromGlobals();
$ajax = $request->isXmlHttpRequest(); // returns false

Case 2: Use any filter in the grid and then use pagination In this case the pagination call is seen as an ajax request and only my grid is reloaded.

$request = Request::createFromGlobals();
$ajax = $request->isXmlHttpRequest(); // returns true

Is there a missing piece with Pagerfanta?

vialcollet commented 6 years ago

I found the issue. Filters have events listeners attached to their elements. But Reset button and Pagerfanta are managed by JQuery selectors. As Jquery was loaded in the footer this was causing the issue until the grid is reloaded while Jquery was available.

What could be done in order to avoid this? It's a common practice to load Jquery in the footer.

DonCallisto commented 6 years ago

@vialcollet if you have any idea, feel free to contribute on this project. As you can see, I'm alone here and I have no time to follow this project under this conditions (doing it all by myself seems like a huge mountain to overtake)

vialcollet commented 6 years ago

Well I actually have no idea... :( Let's close for now as this is a very acceptable workaround.

DonCallisto commented 6 years ago

Let’s keep it open, is still an issue