[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-22 Thread Rahul
Bingo! Martin, Cliff, your suggestion worked very well for me. Here is the reqstatus() function in the controller. I call this function from another function with below statement for SQLForm.grid using links for custom button to fire this code- #Link in other fucntion--- links = [lambda row: A(SP

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-21 Thread Cliff
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 t

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-21 Thread Martín Mulone
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 >

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-21 Thread Johann Spies
Show me the code of regstatus Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-20 Thread Rahul
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.

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-20 Thread Johann Spies
On 20 December 2011 14:25, Rahul 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 w

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-20 Thread Rahul
@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. Again for the community - --

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-20 Thread Johann Spies
On 20 December 2011 07:30, Rahul wrote: Is there a way to hide just the query button as for a public site, > Unfortunately I don't know. You might find some clues inspecting the source code of gluon/sqlhtml.py. Regards Johann -- Because experiencing your loyal love is better than life itself,

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-19 Thread Rahul
Hi Johnann, Thanks for getting back on my queries. I just want to remove the query button from the search section ( I had tried searchable=False earlier and it hid the entire search section). Is there a way to hide just the query button as for a public site, I would not like everyone know

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-19 Thread Johann Spies
On 19 December 2011 12:06, Rahul wrote: > Hi All, > 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.

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-19 Thread Johann Spies
On 19 December 2011 13:41, Rahul wrote: > Also, to add to above questions - How can we hide the query > button on the search area in sqlform.grid. And if its possible to hide > clear button as well!! > > Use the argument 'searchable=False' in your grid definition. See http://www.web2py.com/

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-19 Thread Rahul
Hi All, Also, to add to above questions - How can we hide the query button on the search area in sqlform.grid. And if its possible to hide clear button as well!! Thanks, Rahul D (www.flockbird.com - web2py powered) - On Dec 19, 3:06 pm, Rahul wrote: > Hi All, >

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-19 Thread Rahul
Hi All, 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(_

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-04 Thread Massimo Di Pierro
It odes not work that way. It will translate the string before the substitution: > python web2py.py -S welcome -M -N >>> T.force('it') >>> import os >>> print os.path.getsize('applications/welcome/languages/it.py') 4833 >>> T('%(test)s') % dict(test=1) '1' >>> print os.path.getsize('applications/w

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-04 Thread Pepe Araya
Thanks! Massimo, I noticed that this line of *gluon/sqlhtml.py* 1754: message = error or T('%(nrows)s records found') % dict(nrows=nrows) add a new entry in the language file for every different search result. ("1 records found", "2 records found" ) I think that %(nrows)s should be outsid

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-04 Thread Massimo Di Pierro
yes. SQLFORM.grid(,oncreate=lambda form: do_something_with(form)) SQLFORM.grid(,onupdate=lambda form: do_something_with(form)) the record id is in form.vars.id On Dec 4, 1:22 pm, Pepe Araya wrote: > Hi Massimo and all the team! > > First all: Thanks very much for this feature!I it's r

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-12-04 Thread Pepe Araya
Hi Massimo and all the team! First all: Thanks very much for this feature!I it's really amazing! I have a question: It's possible to call a function after *update* or *edit* that take the id of the record created or updated? (or any other parameter) thanks very much! pepe.

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-30 Thread Rahul
Great! It works. This is so fantastic. I love the way stuff works in web2py. Thanks Massimo. Thanks Rahul D (www.flockbird.com - web2py powered) On Nov 29, 7:16 pm, Massimo Di Pierro wrote: > gird(,...user_sigature=fFalse) > > than do your own authentication outside the function. > > On Nov 2

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-29 Thread Massimo Di Pierro
gird(,...user_sigature=fFalse) than do your own authentication outside the function. On Nov 29, 5:10 am, Rahul wrote: > All, >    How do I view SQLForm.grid View, Edit or Delete forms without using > auth? I have implemented my own custom authorization mechanism which > does not use web2py auth

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-29 Thread Rahul
All, How do I view SQLForm.grid View, Edit or Delete forms without using auth? I have implemented my own custom authorization mechanism which does not use web2py auth in any way. Now the problem is in SQLForm grid that is serialized in my view It say "not authorised" when I click on View button.

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-22 Thread Anthony
Massimo, the issue is that the grid doesn't provide an easy way to include virtual fields. You can do it by using the 'links' argument with a dictionary for each virtual field (though that's a bit cumbersome), but then you cannot use the 'fields' argument to select only a subset of fields or th

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-22 Thread villas
#This uses 'links' to display my virtual field 'extradate'... #Shows grid with all fields grid=SQLFORM.grid(query=(db.prop.id < 10), links=[dict(header='ExtraDate', body=lambda row: row.extradate)] ) #This does the same thing but specifies fields... grid=SQLFORM.grid(query=(db.prop.id < 10), link

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread Massimo Di Pierro
I am bit lost in this thread. Can you summarize the issue? On Nov 21, 7:55 pm, villas wrote: > Yes,  that's a good idea and it does seem to work. > On the downside, I have a huge number of fields and I think the query will > still fetch them all.  Also I have to make a very long list of > field.r

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread Anthony
Yes, we should probably come up with a better solution. On Monday, November 21, 2011 8:55:57 PM UTC-5, villas wrote: > > Yes, that's a good idea and it does seem to work. > On the downside, I have a huge number of fields and I think the query will > still fetch them all. Also I have to make a v

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread villas
Yes, that's a good idea and it does seem to work. On the downside, I have a huge number of fields and I think the query will still fetch them all. Also I have to make a very long list of field.readable = False. So, if a better solution appears, I would be very grateful. However, in any cas

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread Anthony
On Monday, November 21, 2011 5:08:18 PM UTC-5, villas wrote: > > Hi Anthony, > > Nearly got it! That was certainly helpful. > > I can show a VirtualField with your lambda idea, but only when I don't > specify fields=(...). > Hmm, I'm not sure why that is. What if you don't specify any fields b

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread villas
Hi Anthony, Nearly got it! That was certainly helpful. I can show a VirtualField with your lambda idea, but only when I don't specify fields=(...). Unfortunately this means that I have to show every single field in the table, which isn't practical. I tried to include fields(..., db.tabl

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread Anthony
On Monday, November 21, 2011 7:06:25 AM UTC-5, villas wrote: > > Massimo, > > I tried the expressions, but it did not seem to work. Could you consider > providing an example so we could get that working? > > I would be delighted if VirtualFields could be displayed. Do you think > that this

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread villas
Rahul, it is a very good thing that you are trying to pull all this info together. I am sure it will help the documentation effort. Thanks.

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread villas
Massimo, I tried the expressions, but it did not seem to work. Could you consider providing an example so we could get that working? I would be delighted if VirtualFields could be displayed. Do you think that this would be possible? Regards, David

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-21 Thread Rahul
Hey All, I have added a slice for SQLForm.grid in web2py slices. I hope it is of help to everyone starting up with it. Slice#148 (May be it needs proper formatting) http://www.web2pyslices.com/slices/take_slice/148 Villas, I have added the SQLForm.grid syntax derived from your code thread pr

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-20 Thread villas
There is a shortage of documentation on the grid, but I've noticed that I often glean a lot from the code (even when I don't understand it all) -- I guess that's one of the beauties of opensource. So, in addition to any other resources you find, take a glance at this... http://code.google.c

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-20 Thread Rahul
Hi Johann, That is correct but I just wanted to know if I can change the existing functionality for SQLForm.grid View button. To be precise - here is an example of what I am trying to do. Example: The default builtin "View" button on SQLForm.grid has label "View", now how can I change its la

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-18 Thread Johann Spies
On 18 November 2011 09:00, Rahul wrote: > Hi Johan, All, >Sorry but I am not able to get it. With your code above I get > an invalid controller You are not supposed to use that code exactly as it is. You must adapt it for your circumstances: > > links = [lambda row: > A('Edit',_href=

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-17 Thread Rahul
Hi Johan, All, Sorry but I am not able to get it. With your code above I get an invalid controller. I understand that we can add custom buttons with their functions in the controller to the grid. That I am able to do but, I would like to know what changes would I have to do if - 1. I want

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-16 Thread Johann Spies
On 17 November 2011 08:57, Rahul wrote: > > How can I make it use existing functions (that are there by default > SQLForm.grid) associated with View, Edit and Delete (CRUD)'s ? > > Some time ago I have asked the same question and got the following answer form simo...@gmail.com: You can add your

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-16 Thread Rahul
Hi Johann, All, Thanks! that worked like a charm :) Thanks everyone for your immediate help, I'll put up a slice (on web2pyslices) by weekend for with the necessary things needed for making SQLForm.grid up and running with web2py. Now some more questions (for making SQLForm.grid more flexib

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-16 Thread Johann Spies
On 16 November 2011 14:24, Rahul wrote: > Hi All, >I still get a ticket if I use fields code as mentioned by > Johann (I am using latest stable - web2py 1.99.2 not trunk) , does it > work with the trunk version? > > Result1: > fields = (db.projects_post.title, db.projects_posts.project_de

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-16 Thread Rahul
Hi All, I still get a ticket if I use fields code as mentioned by Johann (I am using latest stable - web2py 1.99.2 not trunk) , does it work with the trunk version? Result1: fields = (db.projects_post.title, db.projects_posts.project_details, db.projects_posts.estimated_worth

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-15 Thread Cliff
About Q2: links = [lambda row: A('View',_href=URL("default","view",args=[row.id]))] if auth.has_membership('editors'): links.append([lambda row: A('Edit',_href=URL("default","edit",args=[row.id]))] ) if auth.has_membership('deleters'): lambda row: A('Delete',_href=URL("default","delete",ar

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-15 Thread Jim Steil
As Johann mentioned, the format of your fields var is wrong. Change to db.tablename.fieldname instead of 'tablename.fieldname' and you should be good. Regarding Cliff's comment, all my experience (and therefore advice) is coming from running trunk, not 1.99.2. Q1 - By links above, I meant -

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-15 Thread Cliff
Are you running 1.99.2 or trunk? They do not work the same. On Nov 15, 6:39 am, Rahul wrote: > Hi All, >          Thanks for your help and wonderful posts - I cleared the css > mess and I was able to see the SQLForm.grid properly. I tried working > with multiple and even updated plugin layouts b

Re: [web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-15 Thread Johann Spies
On 15 November 2011 13:39, Rahul wrote: >fields = ('projects_posts.title', >'projects_posts.project_details', > 'projects_posts.estimated_worth' > ) > Try fields = (db.projects_post.title, db.projects_posts.project_details, db.projec

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-15 Thread Rahul
Hi All, Thanks for your help and wonderful posts - I cleared the css mess and I was able to see the SQLForm.grid properly. I tried working with multiple and even updated plugin layouts but it does not display the SQLForm.grid properly if I have a plugin_layouts thing. With default scaffold

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-14 Thread Massimo Di Pierro
true. fields should also work with expressions db.table.field1*db.table.field2+1 although I did not try. On Nov 14, 3:36 pm, JaapP wrote: > One more reason to stick to using fields could be that with fields you > can specify the order in which the columns are shown, this didn't work > for 'column

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-14 Thread JaapP
One more reason to stick to using fields could be that with fields you can specify the order in which the columns are shown, this didn't work for 'columns' On 14 nov, 18:13, Jim Steil wrote: > Ok, columns are gone again... > > Might just be best to stick with using fields. > >      -Jim > > On 11

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-14 Thread Cliff
As for 1.99.2, grid is stable. Using fields = [db.table.field, db.table.otherfield] does not work on the index table. I am using columns and planning to update my controllers when the next release becomes available. On Nov 14, 12:13 pm, Jim Steil wrote: > Ok, columns are gone again... > > Might