Hi Simon,
It didn't work because I put there "table_a", referring to a table where
you need your button displayed. In your case, you could put there
productdatafiles (without db in front).

Since smartgrid drills into related tables, some buttons will not be
applicable to those tables, like in my case, duplicating or printing order
is fine, but not order items, and so on. For this reason I used a
dictionary to specify where a button is allowed, but if you don't need to
specify this, then the way you put it is enough...

Thanks,
Adnan

On Fri, Oct 12, 2012 at 4:15 PM, Simon Carr <simonjc...@gmail.com> wrote:

> OK Sorted it,
>
> Not sure why your example didn't work, but I took a very similar example
> from another web site and it worked fine.
>
> Thanks anyway for putting me on the write track.
>
> Simon
>
>
> On 12 October 2012 20:35, Simon Carr <simonjc...@gmail.com> wrote:
>
>> Do you mean like this:
>>
>> def uploadfile():
>>     filelist = SQLFORM.smartgrid(db.productdatafiles,links=dict(table_a=[
>>                             lambda row: A('Duplicate',
>>                                 _class='button',
>>                                 _onclick='return confirm("Duplicate
>> %s?")' % row.po_number,
>>                                 _href=URL('duplicate_po',args=[row.id])),
>>                             lambda row: A('Print', _class='button',
>> _href=URL('print_all',args=[row.id]))]),
>> )
>>     return dict(filelist=filelist)
>>
>>
>> I tried this, I dont get any errors but I don't see any new buttons or
>> links on my grid either. Am I doing something wrong?
>>
>> Simon
>>
>> On Friday, 12 October 2012 18:49:42 UTC+1, Simon Carr wrote:
>>>
>>> Hi All,
>>>
>>> How do I add an extra link to the SQLFORM.smartgird
>>>
>>> As an example I want to add a link or a button "Process File" and have
>>> it run a controller function that opens and processes an uploaded file.
>>>
>>> Thanks
>>> Simon
>>>
>>  --
>>
>>
>

-- 



Reply via email to