No, I want to be able to construct a Rows object containing all the records
matching the sorting and query on the gird.
I might be able to better illustrate with an example:
model:
...
db.define_table('People',
Field('name', 'string'),
Field('age', 'integer'))
db.People.insert(name="Abe", age=12)
db.People.insert(name="Bob", age=20)
db.People.insert(name="Charlie", age=30)
db.People.insert(name="David", age=25)
controller:
...
grid = SQLFORM.grid(db.People) # at first this will display all the rows
Assume the user visits the controller and then searches for all users older
than 15. This would eliminate Abe and show Bob, Charlie and David. Since my
example is so small, I could use grid.rows to get a Rows object
representing those records. However, if I had 400 records, there's no
immediate way to get a Rows object containing ALL the matching records that
I know of.
On Wednesday, May 7, 2014 1:46:21 PM UTC-5, Anthony wrote:
>
> Are you saying you simply want to display all the records in case the user
> does a search? What if the query returns thousands of records? Anyway, in
> the case of a search, you can always set "paginate" to be sufficiently high:
>
> grid = SQLFORM.grid(..., paginate=200 if request.get_vars.keywords else 20
> )
>
> Anthony
>
> On Wednesday, May 7, 2014 1:46:26 PM UTC-4, Kyle Flanagan wrote:
>
>> Is there a straightforward way to get a Rows object representing ALL the
>> rows referred to by SQLFORM.grid?
>>
>> Something similar to grid.rows, which is good, but it only gives a Rows
>> object with the rows currently being displayed on that page.
>>
>> I'd like to allow the user to search using the grid, then get a Rows
>> object representing the queries rows.
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.