For anyone else looking for a similar answer, I solved this by doing the
following in my controller:
back_button = A(T('Back'), _href=URL('controller', 'function',
user_signature=True), _class='btn')
Returned this as part of my dict back to my view and then did the following
at the top of the
Thanks guys!
Anthony's hint help me out to solve this.
If somebody is interested on how I did it, here's the code:
def search():
users = SQLFORM.grid(db.users,
fields=[db.users.id, db.users.facebook_id, db.users.first_name, db.
users.last_name, db.users.birthday],
sortable=Fa
Are you saying you don't want each record in an HTML table row but instead
want to display each record as a card? There's no built-in way to do that,
but you can hack the returned grid object and replace the HTML table with
your own DOM:
def my_custom_grid_layout(rows):
[code to produce the
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#format--Record-representation
Not entirely sure if the record representation technique will work, but
maybe you could use the lambda to call a named function that renders the
divs for each thumbnail.
I think the css wi
there are multiple errors (and lots of unnecessary parenthesis).
first of all, define a single function to represent your value
def represent_colored(value):
if value == 1:
return .. <--green
elif value == 2:
yellow
elif value == 3:
Thanks for the reply, Niphlod.
Now there was the following question:
I add the following lines to the controller before the grid = SQLFORM.grid
...
warn = db.executesql ('SELECT t.level_warn FROM TEMPER_RC t;')
for val in warn:
if (val == (1)):
db.TEMPER_RC.level_warn.represent
grid uses represent if available.
http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation
On Thursday, June 6, 2013 2:46:47 PM UTC+2, keep...@gmail.com wrote:
>
> Hello everyone.
>
> I'm new to web2py and I have a question about customizing fields in
> SQLform.grid.
Never mind figured it out.
types = {
'bp': 'Product Bonus',
'sb': 'Sponsor Bonus',
}
db.cash_journal.transaction_type.represent = lambda transaction_type,row:
types[transaction_type]
ucashHistoryGrid = SQLFORM.grid(
db.cash_journal,
paginate=10, deletable=False, edit
yes, you can use it like this (in smart grid)
links=dict(purchase_order=[lambda row: A('Duplicate',
_class='button',
_href=URL('duplicate_order',args=[row.id])),
lambda row: A('Print', _class='button',
_href=URL('print_all',args=[row.id]))]
9 matches
Mail list logo