[web2py] Re: CRUD select with autosort headers

2010-11-10 Thread yamandu
But this fails when you to show the result of a query. You can only filter by one field from the serverside. It´s good, but not enough. A lot of potential of this jquery plugin is being lost. The editable jqgrid plugin is good, but is not documented and does not work fully. Would be nice to have

[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
This is my feeble attempt at the problem - but it does the job: def index(): add_submenu() headers = {'email.id': A('Id', _href=URL(vars=dict(orderby='id'))), 'email.email': A('Email address', _href=URL(vars=dict(orderby='email'))), 'email.active':A('Active',

[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
When I say ugly I mean: 1. too much duplication, 2. too much boilerplate code. Just imagine what happens if I apply my solution to more than a few tables. Regards, Andreas On Nov 4, 10:00 pm, baloan balo...@googlemail.com wrote: This is my feeble attempt at the problem - but it does the job:

[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
An updated attempt: def index(): # create header column links headers = dict() for col in db.email_archive.fields: headers['email_archive.' + col] = A(col, _href=URL(vars=dict(orderby=col))) # manage sort order if 'email_archive_orderby' not in session:

[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
Final attempt. Much better now. web2py is cool! def history(): headers, key = auto_orderby(db.email_archive, default_order=('desc', 'id')) emails = crud.select(db.email_archive, headers=headers, orderby=key, limitby=(0, 50)) return dict(emails=emails) def auto_orderby(dal_table,

[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread mdipierro
Good work. You also have the option to do {{=plugin_wiki.widget('jqgrid',table)}} which is sortable, searchable, resizable, can reorder columns, ajax pagination, etc. On Nov 4, 4:38 pm, baloan balo...@googlemail.com wrote: Final attempt. Much better now. web2py is cool! def history():