On 1.99.2, grid will display a row for each row returned by the query,
but won't show any data from the secondary table.
Unless I'm missing a step. Actually I would be happy if that were the
case, as I have one situation where it would be very helpful to show
data from the foreign table.
Insert an owner in this table:
db.define_table('owners',
Field('name', length=32),
format = '%(name)s',
)
Insert two dogs in this table. Point owner_id to the owner inserted
above.
db.define_table('dogs',
Field('owner_id', 'reference owners'),
Field('name', length=32),
format = '%(name)s',
)
This grid will show two rows, reflecting the left join, but it won't
show
either dog's name or id.
def index():
columns = ('owners.name', 'dogs.id', 'dogs.name')
query = db.owners.id > 0
form = SQLFORM.grid(
query,
left = db.dogs.on(
db.dogs.owner_id == db.owners.id
),
columns=columns
)
return dict(form=form
On Dec 14, 11:14 am, Massimo Di Pierro <[email protected]>
wrote:
> Can you provide an example of grid usage that ignores left joins?
>
> On Dec 14, 8:00 am, Johann Spies <[email protected]> wrote:
>
>
>
>
>
>
>
> > On 14 December 2011 14:07, Cliff <[email protected]> wrote:
>
> > > > It is not possible with that query. It is the essence of the query.
>
> > > I don't think grid processes left joins.
>
> > > You might try smartgrid. It knows about left joins and gives you a
> > > link to the foreign table, but it doesn't display any information from
> > > specific rows in that table.
>
> > Thanks for your attention. I have worked around this problem. I was just
> > curious why the grid would count the correct number of records but not
> > display them.
>
> > Regards
> > Johann
> > --
> > Because experiencing your loyal love is better than life itself,
> > my lips will praise you. (Psalm 63:3)