[web2py] Re: Customize SQLFORM.grid view page and add custom "Back" button

2014-09-23 Thread Kyle Flanagan
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

[web2py] Re: Customize SQLFORM.grid

2014-09-10 Thread Luciano Laporta Podazza
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

[web2py] Re: Customize SQLFORM.grid

2014-09-10 Thread Anthony
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

[web2py] Re: Customize SQLFORM.grid

2014-09-10 Thread Cliff Kachinske
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

[web2py] Re: Customize SQLFORM.grid fields

2013-06-10 Thread Niphlod
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:

[web2py] Re: Customize SQLFORM.grid fields

2013-06-10 Thread keeperdss
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

[web2py] Re: Customize SQLFORM.grid fields

2013-06-06 Thread Niphlod
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.

[web2py] Re: Customize SQLFORM.grid

2012-02-09 Thread Bruce Wade
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

[web2py] Re: CUSTOMIZE SQLFORM.grid

2012-01-21 Thread Adi
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]))]