I have two questions:
1. how can I return the number of rows using SQLAlchemy and
PaginateDataGrid?
2. is now possibile to have working sortable column with SQLAlchemy and
PaginateDataGrid?
I've this method in the Root class:
@expose(template=".templates.users")
@paginate('users', limit=20, default_order='name')
def users(self):
user_fields = [PaginateDataGrid.Column('id', 'id', 'ID',
options=dict(sortable=True)),
PaginateDataGrid.Column('name', 'name', 'Name',
options=dict(sortable=True)),
PaginateDataGrid.Column('E-mail',
'email_address', 'email_address', options=dict(sortable=True))]
widget = PaginateDataGrid(user_fields)
users = User.select()
return dict(row_count=count_row(user_table), users=users,
widget=widget)
...
def count_rows(table_name):
database.bind_meta_data()
s = select([func.count("*")], from_obj=[table_name])
s.execute()
return s.scalar()
thanks in advance
mauri
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---