I didn't understand how smartgrid was using request.args which was my main problem. Now that you and massimo pointed it out i've played around and see what is going on. I've got 3 grids in 1 page editing a bunch of tables in a controlled fashion with just a few lines of code. not bad web2py.
Thanks for the response. Dean On Tuesday, April 2, 2013 8:32:18 AM UTC-4, Cliff Kachinske wrote: > > Dean, > > You need to brush up on Python sequences and slicing. > > Try this: db.thetable.thefield.writable = (request.args(-2) == 'new') > > request.args[0] is valid Python but it returns an index out of range error > if request.args is empty. request.args(0) returns None. > > Same with request.args(-x) > > You can always tell what smartgrid is up to by parsing the arg list. > Length of the arg list is significant. It gets longer when working with > child objects. > > On Monday, April 1, 2013 11:24:33 PM UTC-4, DeanK wrote: >> >> So I'm not sure if I understand this one-liner to properly use it. >> Request.args(-1) doesn't quite make sense to me...i would think you'd have >> to index into it starting at 0? >> >> If I place the line in the model or in my function that renders the >> smartgrid form the field is disabled completely. If you try to both create >> a new record or edit an existing record it is disabled. >> >> Again to clarify i'd like to be able to set the field when creating a new >> record, but once it has been created you can't edit the field in the >> smartgrid (but if you create a new record you can edit again). >> >> thanks for your help. >> >> On Monday, April 1, 2013 8:18:10 PM UTC-4, Massimo Di Pierro wrote: >>> >>> Yes: >>> >>> db.thetable.thefield.writable = (request.args(-1) == 'new') >>> >>> On Monday, 1 April 2013 17:31:16 UTC-5, DeanK wrote: >>>> >>>> I've been searching and haven't seemed to find someone trying to do >>>> this yet. I'm wondering if there is a way to use the smartgrid, but limit >>>> what fields can be edited after you create an entry. I want to be able to >>>> use the smartgrid interface to create a new entry in some tables, but >>>> after >>>> the user submits and my oncreate callback runs, the user can only edit >>>> certain fields via the smartgrid (but still view them all). Is that >>>> possible? >>>> >>>> Thanks, >>>> Dean >>>> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.