How to use WebGrid - 1 common examples

To help you get started, we’ve selected a few WebGrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mdipierro / web2py-recipes-source / source / 05_adding_ajax_effects / 08_Improving_data_tables_with_WebGrid / default.py View on Github external
def index():
    """
grid.datasource = db(db.stuff.id>0)               # Set
grid.datasource = db(db.stuff.id>0).select()      # Rows
grid.datasource = db.stuff                        # Table
grid.datasource = [db.stuff,db.others]            # list of Tables
grid.datasource = db(db.stuff.id==db.other.thing) # join
    """
    
    import webgrid
    grid = webgrid.WebGrid(crud)
    grid.datasource = db(db.stuff.id>0)
    grid.pagesize = 10

    grid.enabled_rows = ['header','filter', 'pager','totals','footer','add_links']

    grid.crud_function = 'data'

    grid.fields = ['stuff.name','stuff.location','stuff.quantity']
    
    grid.field_headers = ['Name','Location','Quantity']

    grid.action_links = ['view','edit','delete']
    grid.action_headers = ['view','edit','delete']

    grid.totals = ['stuff.quantity']

WebGrid

A library for rendering HTML tables and Excel files from SQLAlchemy models.

BSD-3-Clause
Latest version published 5 months ago

Package Health Score

57 / 100
Full package analysis

Popular WebGrid functions

Similar packages