Sorry, I cannot reproduce running on Ubuntu -- both printouts as well as the first page of the grid (after sorting on Myfield2) all have the same 20 records when I run it. Maybe someone else can try it on OSX. What happens if you run the OSX binary version of web2py?
Anthony On Tuesday, December 13, 2016 at 6:43:57 PM UTC-5, Scott Hunter wrote: > > If I make a fresh, new app from the Administrative Interface, and replace > the contents of default.py with the following, it will print the first 20 > records that should show up in the grid, first without using limityby (and > using a counter to stop at 20), and then with limityby; the second is > missing records from the first, and matches what appears on the first > sorted page of the grid. > > {The main contents of views/default/index.html need to be replaced with > {{=form}} as well, to see the grid) > > import random > def index(): > db.define_table('mytable', Field('myfield1', 'string'), > Field('myfield2', 'string')) > > f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select( > db.mytable.id)] > if len(f2is1_ids)==0: > db.mytable.truncate() > for v1 in random.sample(xrange(10000),200): > for v2 in random.sample("ABCDE",3): > db.mytable.insert( myfield2="Value%05d"%v1, myfield1=v2 ) > f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select( > db.mytable.id)] > query = db.mytable.id.belongs(f2is1_ids) > i = 0 > for d in db(query).select(orderby=db.mytable.myfield2): > print "%5d"%d.id, d.myfield1, d.myfield2 > i += 1 > if i==20: > break > print"---" > for d in db(query).select(orderby=db.mytable.myfield2,limitby=(0,20)): > print "%5d"%d.id, d.myfield1, d.myfield2 > args = { 'orderby':db.mytable.myfield1, 'editable':False, > 'deletable':False} > form = SQLFORM.grid(query, csv=False, details=False, searchable=False, > create=False, > paginate = 20, > orderby=db.mytable.myfield1, editable=False, deletable=False) > return locals() > > > On Tuesday, December 13, 2016 at 3:01:19 PM UTC-5, Anthony wrote: >> >> While including id may make a difference in general, it should (and did) >>> not in this case: the reason for the long belongs list is that queries are >>> made to insure that no 2 records with the same Dog_ID appear in that list. >>> >> >> Sorry, I didn't notice that the first field in your print statements was >> f_Dog_ID (thought it was just the id field). >> >> Anyway, it's not clear what the problem is. I suggest you pack and attach >> a minimal app that exhibits the behavior. >> >> Anthony >> >>> -- 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.