I know the price (in terms of performance) I have to pay to show more than 100+ tables but it’s worth it for our implementation, I would love to completely disable pagination or just increase the limit to 500 or more.
Although the paginated view is good for page loading, problems arise when an existing row needs to be edited. There is no quick way for the user to search for/go to a particular row to edit it. In some cases we have over 20 “pages” which need to be manually searched to get to the row we are looking for where previously we could just use Ctrl/Cmd + F to look for it.
One way is to just hook events for each particular doctype, loop over frm.grids, set the grid.grid_pagination.page_length to 10000, .page_index to 1 and .total_pages to 1, and then call .render_pagination (all on the grid.grid_pagination object) and possibly call frm.refresh(). That’s the solution above (but I think sometimes you need to set page_index and/or total_pages and/or call render_pagination(); I haven’t played with it a lot).
I have worked out how to override this for all forms, but it is horrific hackery of the worst kind In a custom app, add a JS file that runs for everything in hooks.py (app_include_js). Then have something like:
Replace the page length of 1000 above with your choice (or set it using a boot session or whatever).
I first noticed this in Customize Form, where it annoyed me (but not enough to do anything about it), then I got complaints from the staff from other DocTypes so I have designed this work-around.
This would have been a lot easier if Frappe had just made it user-configurable instead of a magic number buried in a class which is really hard to access… I realise it would be a very easy Pull Request to shift it to a setting somewhere so I shouldn’t moan too much without actually doing something about it!
The following code actually works in Client Script:
frm.get_field(‘time_logs’).grid.grid_pagination.page_length = 70;
but it will NOT work if the number is below 50
frm.get_field(‘time_logs’).grid.grid_pagination.page_length = 30;
will show 50 rows (even if pagination will be actually scrambled …)