In my case, I have records with 2 fields, A & B; I want one record to be 
displayed for each distinct value of A when B is either 1 or 2, but it is 
possible that each will be present, so I use groupby A to avoid duplication.

I tried using a smartgrid, but it exhibited the same groupby/add behavior 
(although maybe I could use its constraint parameter to accomplish this 
without using groupby).

- Scott

On Saturday, December 3, 2016 at 11:11:58 AM UTC-5, Anthony wrote:
>
> This is tricky. Write operations (as well as the details view) are 
> disabled with groupby because the rows in the grid do not necessarily 
> represent individual records. Of course, that shouldn't necessarily 
> preclude adding new records, but from a user perspective, we have to think 
> of what is meant by "Add" in the context of a table that is displaying 
> aggregated data rather than individual records. Are you adding a new row to 
> the grid (which doesn't quite make sense) or a new individual record to the 
> table used to generate the grid (sensible, but maybe not as clear)?
>
> I don't have a strong opinion, but I suppose it wouldn't be a bad idea to 
> at least allow the developer the option of enabling create with groupby. In 
> that case, though, we might have to default to create=False for backward 
> compatibility.
>
> Feel free to file a Github issue and refer to this thread.
>
> Anthony
>
> On Saturday, December 3, 2016 at 8:53:45 AM UTC-5, Scott Hunter wrote:
>>
>> I have a SQLFORM.grid in which I would like to use groupby as well as be 
>> able to create records.  But when I supply the groupby parameter, the Add 
>> Record button disappears, and can be made to re-appear if the only thing I 
>> change is remove the groupby parameter.
>>
>> Is this a bug?  If it is a feature, can someone explain the reasoning 
>> behind it, and how I would best work around it?
>>
>> - Scott
>>
>

-- 
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