Re: [web2py] Re: simple button in grid question

2013-09-17 Thread Alex Glaros
Thanks Villas, it works perfectly. I really appreciate the help. Alex On Tuesday, September 17, 2013 8:04:28 AM UTC-7, villas wrote: > > Tip: when you are struggling, take something which works and then using > 'baby-steps' incrementally change the example until it is transformed into > what

Re: [web2py] Re: simple button in grid question

2013-09-17 Thread villas
Tip: when you are struggling, take something which works and then using 'baby-steps' incrementally change the example until it is transformed into what you need. Here is something which you previously said was working: def view_all_suggestions_and_comments(): query = (db.IdeaComment.idea

Re: [web2py] Re: simple button in grid question

2013-09-16 Thread Alex Glaros
looks like it's getting closer, but receive this error: 'str' object is not callable On Monday, September 16, 2013 8:46:48 AM UTC-7, Adi wrote: > > if you replace the grid part, does this work: > > > grid = SQLFORM.grid(db.Idea,editable=is_owner, > deletable=is_owner,

Re: [web2py] Re: simple button in grid question

2013-09-16 Thread Alex Glaros
Hi Adi and Javier, I can't get the syntax to work. Can you please baby me though the phrasing and just copy the first button twice in this working example so that two identical buttons appear? def view_suggestions(): db.Idea.id.represent = lambda id, r: A('Post shared services idea', _hr

Re: [web2py] Re: simple button in grid question

2013-09-16 Thread Adi
actually, you can also define a table that links apply to. this way you won't get the error, when applying functionality to a wrong table... links=dict(purchase_order=[ lambda row:(_get_order_details(row)), lambda ro

Re: [web2py] Re: simple button in grid question

2013-09-16 Thread Javier Pepe
You need pass a list of dict links = [{'header':'', 'body': lambda row: A('',_title='Procesar',_class='icon-refresh',_href=URL(c='planilla', {'header':'', 'body': lambda row: A('',_title='Mail',_class='icon-envelope',_href='index/pedircontadores/% {'header':'', 'body': lambda r

[web2py] Re: simple button in grid question

2013-09-15 Thread Alex Glaros
What is syntax for TWO or more buttons? I've tried several variations. Would it be two "dict" phrases, or two header phrases separated by commas? One button will call one function, and the other would call a different function. thanks, Alex On Saturday, September 14, 2013 6:56:24 PM UTC-7,

[web2py] Re: simple button in grid question

2013-09-14 Thread Alex Glaros
Works perfect Adi and Villas, much appreciated. Here's the complete code: def view_all_suggestions_and_comments(): query = (db.IdeaComment.ideaID==db.Idea.id) & (db.IdeaComment.partyID==db.Party.id) grid = SQLFORM.grid(query, ,links = [dict(header='Virtual Field', body=lambda row: A(

[web2py] Re: simple button in grid question

2013-09-14 Thread Adi
lambda row: A('Complete', _class='btn', _id='btn_complete', _onclick='return confirm("Complete Order %s? (%s %s)")' % (row.id,

[web2py] Re: simple button in grid question

2013-09-14 Thread Alex Glaros
it works correctly Villas, thanks. how could I turn "Add a comment!" text into a button. Possible syntax ",_class="btn btn-mini"", but where does it go? thanks, Alex On Saturday, September 14, 2013 10:23:00 AM UTC-7, villas wrote: > > Maybe this would work using row.idea.id like this... > > g

[web2py] Re: simple button in grid question

2013-09-14 Thread villas
Maybe this would work using row.idea.id like this... grid = SQLFORM.grid(query, links = [dict(header='Virtual Field', body=lambda row: A('Add a comment!', _href=URL('comment_on_a_suggestion' , vars=dict(filter=row.idea.id ))) )] ) You can also now include "virtual

[web2py] Re: simple button in grid question

2013-09-14 Thread Alex Glaros
thanks Villas but I receive this error: Row' object has no attribute 'id' perhaps it doesn't know which of the joined "id"s to reference this work-around works because it let's system know which id it is: db.Idea.id.represent = lambda id, r: A('Add a comment!', _href=URL('comment_on_a_sugge

[web2py] Re: simple button in grid question

2013-09-14 Thread villas
Try this... grid = SQLFORM.grid(query, links = [dict(header='Virtual Field', body=lambda row: A('Add a comment!', _href=URL('comment_on_a_suggestion', vars=dict(filter=row.id)))

[web2py] Re: simple button in grid question

2013-09-13 Thread Dave S
On Friday, September 13, 2013 1:57:28 PM UTC-7, Alex Glaros wrote: > > I tried this but got "lambda requires 2 args, 1 given" error, plus need to > be able to pass Idea.id parm to the button. How to do that? > > grid = SQLFORM.grid(query,links = [dict(header='Virtual > Field',body=lambda id

[web2py] Re: simple button in grid question

2013-09-13 Thread Alex Glaros
I tried this but got "lambda requires 2 args, 1 given" error, plus need to be able to pass Idea.id parm to the button. How to do that? grid = SQLFORM.grid(query,links = [dict(header='Virtual Field',body=lambda id, r: A('Add a comment!', _href=URL('comment_on_a_suggestion', vars=dict(filter

[web2py] Re: simple button in grid question

2013-09-13 Thread villas
Hope this helps... >From the book: links is used to display new columns which can be links to other pages. The links argument must be a list of dict(header='name',body=lambda row: A(...))where header is the header of the new column and body is a function that takes a row and returns a value.