• 5281 views
  • 0 comments
  • loading...

SQLFORM.gird gives you the ability to browse, search, sort, create, update and delete records from a single object It is based on SQLFORM and it has a lot of similarities with it.

In order to use more than 1 grid on one page, you will need to use formname






@auth.requires_login() 

def manage_users():
grid = SQLFORM.grid(db.auth_user)
return locals()

Attributes / Arguments

Specify which fields are fetched from the database

auth.requires_login() 
def manage_users(): 
    grid = SQLFORM.grid(db.auth_user, fields=[db.auth_user.id,auth_user.name]) 
    return locals()

Retrieves record based on search query. 

  grid = SQLFORM.grid(db.auth_user.disabled==True, user_signature=False)


field_id must be the field of the table to be used as ID, for example db.mytable.id. 


This is useful when the grid query is a join of several tables. Any action button on the grid (add record, view, edit, delete) will work over db.mytable.

@auth.requires_login() 
def manage_users(): 
    grid = SQLFORM.grid(db.auth_user, fields=[db.auth_user.id,auth_user.name]) 
    return locals()


Examples

loading...


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)