Add button to smartgrid?

59 views
Skip to first unread message

Tom Russell

unread,
Jun 26, 2013, 11:51:02 AM6/26/13
to web...@googlegroups.com
I need to add a button to the smartgrid but not like doing create=True because I have a form factory that has 2 other tables associated with the one. I know in html I can simply add a line for a button but since I am not using html for this how would I add a button to that page to reference my own view?

Thanks.

Jim S

unread,
Jun 26, 2013, 2:42:26 PM6/26/13
to web...@googlegroups.com
Where in the smartgrid do you need to add it?  Can you just have a custom view?  Maybe post some code or pics to show what you're trying to accomplish.

-Jim

rāma

unread,
May 21, 2019, 3:52:57 AM5/21/19
to web...@googlegroups.com
I used:

for x in grid.elements('td.row_buttons'):
    x
.insert(4, A(
       
[SPAN(_class="menu-icon fa fa-paper-plane"), SPAN("Go To", _class="buttontext button", _title="GoTo")]
       
, _href="TEST", _class="button btn btn-default btn-secondary"))

This is specific to my needs, you may not want those span and class attributes. It creates a Go To button after view, edit, and delete if its turned on.

rāma

unread,
May 21, 2019, 4:04:44 AM5/21/19
to web2py-users
Or better:

links=dict(meter_list=[lambda row:

                       A
(
                           
[SPAN(_class="menu-icon fa fa-paper-plane"),
                            SPAN("Go To "+str(row.id), _class="buttontext button", _title="GoTo")]
                           
, _href="TEST", _class="button btn btn-default btn-secondary")]
           
))

you can get the row properties into your button. But, what I am not sure is how to control where it appears in the table. Right now, by default, it appears before table referencing links.
Reply all
Reply to author
Forward
0 new messages