예제 #1
0
def index():
    SQLFORM.grid = SolidGrid(renderstyle=True)  # override the original grid function
    
    from plugin_tablecheckbox import TableCheckbox
    tablecheckbox = TableCheckbox()
    
    # Insert an extra element to select an action
    tablecheckbox.components.insert(0,
        SELECT('new', 'old', _name='action', _style='width:70px;',
                requires=IS_IN_SET(['new', 'old'])))
    if tablecheckbox.accepts(request.vars):
        db(table_product.id.belongs(tablecheckbox.vars.tablecheckbox)).update(status=tablecheckbox.vars.action)
        session.flash = 'Updated'
        redirect(URL('index'))
    extracolumns = [tablecheckbox.column()]
    
    grid = SQLFORM.grid(table_product,
        #fields=[table_product.ALL],
        columns=[extracolumns[0], table_product.id,
                 (table_product.name, table_product.status),
                  table_product.description,
                 (table_product.publish_date, table_product.price)],
        extracolumns=extracolumns,
        scope=table_product.status,
        )
        
    return dict(buttons=grid.gridbuttons,
                search=grid.search_form if hasattr(grid, 'search_form') else '',
                status=DIV(tablecheckbox) if hasattr(grid, 'records') else '',
                table=grid)
예제 #2
0
def index():
    SQLFORM.grid = SolidGrid(renderstyle=True) # override the original grid function
    
    from plugin_tablecheckbox import TableCheckbox
    tablecheckbox = TableCheckbox()
    
    # Insert an extra element to select an action
    tablecheckbox.components.insert(0, 
        SELECT('new', 'old', _name='action', _style='width:70px;',
                requires=IS_IN_SET(['new', 'old'])))
    if tablecheckbox.accepts(request.vars):
        db(table_product.id.belongs(tablecheckbox.vars.tablecheckbox)).update(status=tablecheckbox.vars.action)
        session.flash = 'Updated'
        redirect(URL('index'))
    extracolumns = [tablecheckbox.column()]
    
    grid = SQLFORM.grid(table_product, 
        #fields=[table_product.ALL],
        columns=[extracolumns[0], table_product.id, 
                 (table_product.name, table_product.status),
                  table_product.description,
                 (table_product.publish_date, table_product.price)],
        extracolumns=extracolumns,
        scope=table_product.status, 
        )
        
    return dict(buttons=grid.gridbuttons, 
                search=grid.search_form if hasattr(grid, 'search_form') else '',
                status=DIV(tablecheckbox) if hasattr(grid, 'records') else '',
                table=grid)
    
예제 #3
0
def index():

    ################################ The core ######################################
    tablecheckbox = TableCheckbox()

    # Insert an extra element to select an action
    tablecheckbox.components.insert(
        0,
        SELECT('update',
               'delete',
               _name='action',
               _style='width:70px;',
               requires=IS_IN_SET(['update', 'delete'])))

    if tablecheckbox.accepts(request.vars):
        # Selected record ids will be submitted
        session.flash = 'submitted %s' % tablecheckbox.vars
        redirect(URL('index'))

    extracolumns = [tablecheckbox.column()]
    ################################################################################

    table = SOLIDTABLE(db(db.product.id > 0).select(),
                       extracolumns=extracolumns,
                       renderstyle=True)
    return dict(table=table, tablecheckbox=tablecheckbox)
예제 #4
0
def index():
    
################################ The core ######################################
    tablecheckbox = TableCheckbox()
    
    # Insert an extra element to select an action
    tablecheckbox.components.insert(0, 
        SELECT('update', 'delete', _name='action', _style='width:70px;',
                requires=IS_IN_SET(['update', 'delete'])))
    
    if tablecheckbox.accepts(request.vars):
        # Selected record ids will be submitted
        session.flash = 'submitted %s' % tablecheckbox.vars
        redirect(URL('index'))
        
    extracolumns = [tablecheckbox.column()]
################################################################################
        
    table = SOLIDTABLE(db(db.product.id>0).select(),
                       extracolumns=extracolumns, renderstyle=True)
    return dict(table=table, tablecheckbox=tablecheckbox)