I also hope this can be done. In sqlhtml.py, simply change following code:
if left is not None:
tablenames += db._adapter.tables(left)
into:
if left is not None:
if isinstance(left, (list)):
for l in left:
tablenames += db._adapter.tables(l)
else:
tablenames += db._adapter.tables(left)
On Friday, January 18, 2013 11:17:19 AM UTC-5, Massimo Di Pierro wrote:
>
> Looks good.
> Can you please send me a patch applied to the trunk version?
>
> On Friday, 18 January 2013 05:47:20 UTC-6, Felipe Meirelles wrote:
>>
>> Did anyone saw it?
>>
>> On Monday, January 14, 2013 5:41:36 PM UTC-2, Felipe Meirelles wrote:
>>>
>>> Please desconsider the sorter_icons parameter, its a custom
>>> implementation of mine.
>>> I can post this patch too if you think its relevant.
>>>
>>> Thanks!
>>>
>>> On Monday, January 14, 2013 5:38:53 PM UTC-2, Felipe Meirelles wrote:
>>>>
>>>> Hi,
>>>>
>>>> When you try to make more than one left join on a SQLFORM.grid as:
>>>>
>>>> grid = SQLFORMCustom.grid(db.device,
>>>> fields=[db.device.serial, db.device.device_type,
>>>> db.device.vehicle, db.vehicle.plate, db.chip.imei, ],
>>>> field_id=db.device.id,
>>>> left=[db.chip.on(db.chip.id==db.device.chip), db.vehicle.on(
>>>> db.vehicle.id==db.device.vehicle)],
>>>> paginate=max_results,
>>>> showbuttontext=False,
>>>> formstyle='divs',
>>>> paginate_icons=paginate_icons,
>>>> sorter_icons=sorter_icons
>>>> )
>>>>
>>>> it can't display the join fields as it dosen't find the fields on the
>>>> query in sqlhtml.py line 1083.
>>>>
>>>> Can you apply this patch on line 1083?
>>>>
>>>> if left is not None:
>>>> if isinstance(left, (list)):
>>>> for l in left:
>>>> tablenames += db._adapter.tables(l)
>>>> else:
>>>> tablenames += db._adapter.tables(left)
>>>>
>>>
--