Hi Anthony, great thanks a lot for the info! I'll post a bug report as well.
On Monday, November 19, 2018 at 4:05:30 PM UTC+1, Anthony wrote: > > The code used by the grid to generate the DAL query is at > https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2351. > Notice you can do: > > SQLFORM.grid (..., cache_count=my_custom_count_function) > > where my_custom_count_function takes the DAL Set object used by the grid > to generate the query for the grid as well as request.vars and returns the > count. So, you can work around whatever the grid/DAL are doing by writing > custom code to calculate the count. Note, although the argument is called > cache_count, the function does not actually have to cache the count value > -- it can simply fetch the count every time called. > > To see how the DAL generates SQL for Oracle, look at > https://github.com/web2py/pydal/blob/master/pydal/dialects/oracle.py for > Oracle specific syntax as well as > https://github.com/web2py/pydal/blob/master/pydal/dialects/base.py#L35 > for the common dialect from which Oracle inherits. > > Finally, after an HTTP request, you can inspect db._timings for a list of > all DAL queries made during the request (and the time they took to execute) > in order to see the exact SQL generated by the grid to determine the count > (db._timings is included in response.toolbar(), which you can temporarily > include in your grid view via {{=response.toolbar()}}). > > Anthony > > On Monday, November 19, 2018 at 8:04:42 AM UTC-5, Thomas Klopf wrote: >> >> Hi everyone, >> Please could someone point out how/where the pagination works with >> SQLFORM.grid? I found a bug with the Oracle driver, where queries will >> fail if you're trying to filter columns that aren't displayed in the >> 'fields' list passed to SQLFORM.grid(). Basically I need to get to the >> code that generates the 'select count(*)' SQL for finding how to limit the >> query for paging. Oracle is complaining with 'ora-00904 invalid >> identifier' with columns that aren't given in the fields argument, when >> pagination is needed. >> >> Anyway I'm doing my best to reverse-engineer the DAL code but I'm lost >> now.. >> >> Thanks! >> -Tom >> >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.