Hmm, from researching the forum on the topic and reading the doc I could
have sworn that smartgrid supported left. In fact, I believe in my testing
I have seen it respond appropriately to the left argument. Nevertheless, I
changed my code back to grid (I had started out with grid and moved to
smartgrid). Now it looks like this, but produces the same "unsupported
query" error message:
grid = SQLFORM.grid(
query,
left=db.brand.on(
(auth.accessible_query('read', db.brand, auth.user_id))
&
(db.brand.id == db.url_queue.brand_id)
),
fields=[
db.url_queue.brand_id,
db.url_queue.host_id,
db.url_queue.mail_cnt,
db.url_queue.url,
db.url_queue.status,
],
headers={
'url_queue.brand_id': 'Brand',
'url_queue.host_id': 'Host',
'url_queue.mail_cnt': 'Mail Count',
'url_queue.url': 'URL',
'url_queue.status': 'Status',
},
paginate=20,
maxtextlength=100,
searchable=True,
deletable=True,
editable=False,
details=False,
create=False,
ui='web2py',
)
On Monday, June 4, 2012 12:40:49 AM UTC+8, Massimo Di Pierro wrote:
>
> Grid can do joins. Smartgrids cannot. The latter is "smart" in the sense
> that it displays only one table at the time but knows how to link other
> tables automatically.
>
> In principle it should be possible to make left joins work. Please open a
> suggestion for improvement with an example on google issues
>
> Massimo
>
> On Sunday, 3 June 2012 11:21:44 UTC-5, weheh wrote:
>>
>> I'm running SQLFORM.smartgrid with a left= join as follows:
>>
>> grid = SQLFORM.smartgrid(
>> db.url_queue,
>> constraints=dict(url_queue=query),
>> left=db.brand.on(
>> (auth.accessible_query('read', db.brand, auth.user_id
>> )) &
>> (db.brand.id == db.url_queue.brand_id)
>> ),
>> fields=[...],
>> headers={...},
>> paginate=20,
>> maxtextlength=100,
>> searchable=True,
>> deletable=True,
>> editable=False,
>> details=False,
>> create=False,
>> ui='web2py',
>> linked_tables=[],
>> )
>> The left join is causing smartgrid to give me an "unsupported query"error
>> message
>> . If I comment out the left= arg, the error message goes away but the
>> query returns the wrong data, as expected. Any help would be appreciated.
>> Thanks.
>>
>
On Monday, June 4, 2012 12:40:49 AM UTC+8, Massimo Di Pierro wrote:
>
> Grid can do joins. Smartgrids cannot. The latter is "smart" in the sense
> that it displays only one table at the time but knows how to link other
> tables automatically.
>
> In principle it should be possible to make left joins work. Please open a
> suggestion for improvement with an example on google issues
>
> Massimo
>
> On Sunday, 3 June 2012 11:21:44 UTC-5, weheh wrote:
>>
>> I'm running SQLFORM.smartgrid with a left= join as follows:
>>
>> grid = SQLFORM.smartgrid(
>> db.url_queue,
>> constraints=dict(url_queue=query),
>> left=db.brand.on(
>> (auth.accessible_query('read', db.brand, auth.user_id
>> )) &
>> (db.brand.id == db.url_queue.brand_id)
>> ),
>> fields=[...],
>> headers={...},
>> paginate=20,
>> maxtextlength=100,
>> searchable=True,
>> deletable=True,
>> editable=False,
>> details=False,
>> create=False,
>> ui='web2py',
>> linked_tables=[],
>> )
>> The left join is causing smartgrid to give me an "unsupported query"error
>> message
>> . If I comment out the left= arg, the error message goes away but the
>> query returns the wrong data, as expected. Any help would be appreciated.
>> Thanks.
>>
>