You can create a dictionary that represents the arguments passed to the SQLFORM(), and pass it in createargs, editargs, viewargs. The code basically updates the SQLFORM (not the grid) with the appropriate create/edit/view args: https://github.com/web2py/web2py/blob/7d8f4360facf4676253492952c28777147736c00/gluon/sqlhtml.py#L2094 Take a look at the SQLFORM signature to understand what can be passed in: http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM

Hope this helps.

________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Wed, 04-06-2014 9:17 AM, Fabiano Almeida wrote:
In manual dont have example of createargs:

    while |createargs|, |editargs| and |viewargs| are passed only to
    the specific create, edit and details SQLFORMs


this is the only reference manual


Em quarta-feira, 4 de junho de 2014 00h43min27s UTC-3, Fabiano Almeida escreveu:

    Hi,

    How to use creatargs in SQLFORM.grid?

    Table:
    Objeto = db.define_table('objeto',
          SQLField('almoxarifado_id', db.almoxarifado, notnull=True,
    readable=True, writable=True, label='Almoxarifado'),
          SQLField('nome', 'string', length='50', notnull=True,
    label='Nome'),
          SQLField('quantidade', 'integer', notnull=True, default=0),
          SQLField('localizacao', 'string', length='50',
    label='Localização'),
          SQLField('obs', 'text', label='Especificação'))
    Objeto.almoxarifado_id.requires=IS_IN_DB(db, 'almoxarifado.id
    <http://almoxarifado.id>', '%(nome)s')

    def index():
        alm = request.args(0) or redirect(URL('almoxarifado','index'))
        form = SQLFORM.grid(Objeto.almoxarifado_id == alm,
    fields=[Objeto.nome, Objeto.quantidade, Objeto.localizacao],
    createargs={'Objeto.almoxarifado_id':alm}, user_signature=False,
    csv=False)
        return dict(form=form)

    I try create new record with field Objeto.almoxarifado_id =
    args(0), to hide this field in form.

    Thanks in advance,

    Fabiano.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 <mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 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/d/optout.

Reply via email to