Thanks Niphlod, that did the trick. I did the same for createargs as well.
Normally, I would just reorder the fields in the table def and go on with
life, but in this case, I have a set of base fields that a handful of my
tables share. I needed one of these base fields to be first and another to
be last.
Thanks again!
On Tuesday, April 21, 2015 at 2:48:32 PM UTC-5, Niphlod wrote:
>
>
>
> On Tuesday, April 21, 2015 at 9:36:40 PM UTC+2, Dave S wrote:
>>
>>
>>
>> On Tuesday, April 21, 2015 at 12:32:28 PM UTC-7, Niphlod wrote:
>>>
>>> I know that may sound as "not-really-a-reply", but can't you just switch
>>> Field order in the table definition ?
>>>
>>
>> Perhaps it is a legacy table and he's stuck with the table field order.
>> If so, a temporary table could be a work-around, but maybe there's a less
>> complex way.
>>
>> /dps
>>
>
> Even with legacy tables, the field order doesn't matter. The ordering of
> fields doesn't matter, the important thing is to map column names and the
> correct type to the underlying model.
> However, here we go the "official" reply.
>
> @Kyle: there's a small "hiccup" with what you're proposing, because the
> grid can show fields from any number of tables. The table you're going to
> edit is ruled either as the leftmost appearing on the "query" , or
> specifying its 'id' as field_id. You passing the table name is just a
> restricted usecase scenario of the whole potential.
>
> That being said, the edit form is istantiated with the result of "merging"
> two mappings: formargs and later editargs.
> <tl;dr>
> If in a
>
> SQLFORM(db.ATable)
>
> you can choose the order of displayed fields with
>
> SQLFORM(db.ATable, fields=['b', 'a', 'c'])
>
> you can force the "edit" form of SQLFORM.grid with
>
> SQLFORM.grid(db.ATable, editargs={'fields' : ['b', 'a', 'c']})
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.