gijgo icon indicating copy to clipboard operation
gijgo copied to clipboard

Filter records when paging

Open webcliq opened this issue 8 years ago • 3 comments

I have a Grid with multiple pages. I am using remote AJAX against a PHP datasource. I try paging through the records to find the one that I want. I have no success, so I enter a column filter. By default, Gijgo sends the following parameters to the Server:

page | 3 limit | 15 c_common | login

By default, the server will attempt to return Records 30 to 45 with filter "login" applied. Result! No Records. The page paramameter must be reset to 0 (zero). I can do this on the Server but this is wrong, because if the Recordset had contained more than 15 records I would never be able to reach the second and subsequent pages without some instruction from Gijgo Grid as to when and when not to reset the pager.

Obviously and at this moment. I know that this "feature" exists and whenever I need to apply a filter, I must return to Page 0 before applying it.

As far as I remember, from writing my own Pagination in the past, it is necessary to maintain state for the three elements - paging, filter and sort - in such a way that the correct combinations can be sent to the server as required.

In addition, I have a problem with the naming of the parameters. Using "page" and "limit" is Ok and can be changed anyway. But using the name of the field on which to filter, is not. How can the Server know that this is a Filter? I have worked out my own solution by parsing the REQUEST and omitting page, limit and sort etc., assuming that anything must be filter.

I believe that the correct approach would be to send an array:

page | 3 limit | 15 filter | {c_common | login}

And of course, dealing with sort or orderby in a similar way.

I hope my explanation makes sense, that I have not overlooked some setting in the Configuration that would correct this situation. I look forward to hearing from you.

I congratulate you on your hard work and effort.

webcliq avatar Sep 01 '17 17:09 webcliq

Hello and thanks a lot for the feedback.

I will improve the reload method in future versions to reset the page to 1 , because a lot of people complain about it.

I don't want to move all the filters in separate array, because this is going to be a huge change for all the users that are using the grid right now and I want to avoid such inconveniences for them.

atatanasov avatar Sep 02 '17 14:09 atatanasov

So did you modify the reload method to reset the page number to 1 when searching ?

iamnapster avatar May 15 '18 09:05 iamnapster

If it's still relevant, I use $('[data-role=page-first]').click(); Just on here hoping someone reported pagination, guess no new updates. Would be nice to have a nice clear way to set current page index when filtering/searching the dataset.

But hey, I got a way around it and loving the grid ;)

Deathnetworks avatar Sep 07 '22 02:09 Deathnetworks