Rahul, What is not working?
When you click the button, does your reqstatus function fire at all? You can find out by inserting "print 'hello, world'" as the first line of the function, then looking at the web2py console for output. If you run in command line, the rocket output shows up in the terminal session where you started web2py. If the function isn't firing, then your link is malformed. If the function is firing and the table isn't being updated then your problem is somehow in the function. Expanding on Martin's suggestion, something like this should work. query = db.mytable.id == request.args[0] db(query).update(myfield = some_value) links = [lambda row: A(SPAN(_class='icon plus'),'Send Request',_class='positive button',_href=URL("default","reqstatus",args=[row.id]))] On Dec 21, 5:54 am, Martín Mulone <mulone.mar...@gmail.com> wrote: > I'm not sure what you want but you can pass args to grid. Like: > > row_id = request.args[0] > query = (db.mytable.id == row_id) > > table = SQLFORM.grid(query, > ... > args=request.args, > ... > ) > > 2011/12/21 Rahul <rahul.dhak...@gmail.com> > > > > > > > > > > > Hi Johann, > > Here are the details --- > > > I have two tables - I need to grab the id of a contact from first > > table and use it to update a field status with values as Sent, Request > > etc. in another table id being the same in both the table. > > Now in the below code, "Send Request" is just a button. > > > links = [lambda row: A(SPAN(_class='icon plus'),'Send > > Request',_class='positive > > button',_href=URL("default","reqstatus",args=[row.id]))] > > > This code is using the id (row.id) from my contact table which is > > fine. Now, I want to use this id to send a request (using "Send > > Request" button in this grid) through reqstatus function. reqstatus is > > a separate function in my controller. > > > My problem is how can I use the row.id of this sqlform.grid any > > particular row and send a status update for a different table using > > this id. > > > In short i want to use the above [row.id] in a separate function and > > pass it in a query. How can I achieve it? I hope I am clear this time. > > Let me know if case you need more details. > > > I checked the below link - but could not get it > >http://www.mail-archive.com/web2py@googlegroups.com/msg77334.html > > > Thanks, Rahul D (www.flockbird.com- web2py powered) > > ------------------------ > > > On Dec 20, 6:31 pm, Johann Spies <johann.sp...@gmail.com> wrote: > > > On 20 December 2011 14:25, Rahul <rahul.dhak...@gmail.com> wrote: > > > > > @Johann, below code does not work for me. :( > > > > links = [lambda row: A('Edit' , _href = URL('default', > > > > 'edit_journal', args = [row.id]))] > > > > > I used details='False' and it does not show the buttons to me, but > > > > shows my custom button only which is what I intended. > > > > details = False not details = 'False' > > > > That disable the 'View' button. > > > > > Again for the community - ----------- > > > > I was just wondering if I can use the row.id or any information with > > > > sqlform.grid - > > > > Below is the link I have defined to show a button called Send Request. > > > > I have re-directed it to use a custom function "regstatus" that passes > > > > a row.id argument. > > > > ---code--- > > > > links = [lambda row: A(SPAN(_class='icon plus'),'Send > > > > Request',_class='positive > > > > button',_href=URL("default","reqstatus",args=[row.id]))] > > > > --- > > > > I want to know how can I use the row.id (in above -> args=[row.id]) > > > > value and use it to make queries considering I want to use this id in > > > > my function "reqstatus" above - > > > > > Example- I would like to send some request to the record (row id) on > > > > which I am say a friend request etc. > > > > > Can we achieve this? > > > > It is still unclear to me what you want to do and what the problem is > > using > > > row.id. > > > > What is 'Send Request'? > > > > Maybe if you show your code it will get clearer. > > > > Regards > > > Johann > > > > -- > > > Because experiencing your loyal love is better than life itself, > > > my lips will praise you. (Psalm 63:3) > > -- > http://martin.tecnodoc.com.ar