web2py:替换Smartgrid标准删除按钮

时间:2019-01-21 07:12:57

标签: python web2py

我想替换Smartgrid中的标准删除按钮。这是我尝试做的事情:

def list_service_types():
    grid = SQLFORM.smartgrid(db.service_types
        , fields = [db.service_types.type_name, db.services.service_name]
        , ondelete = ondelete_service_type
        , links = [lambda row: A('Delete', _href='#', _glyph="icon-trash", _class="button btn btn-secondary", )]
        )
    return locals()

问题:

1)我无法显示图标废纸g字形/图标
2)如何将新按钮放在行尾,最终取代标准的删除按钮

屏幕截图如下:
Screenshot

编辑1
我设法通过以下links使字形显示:

    , links = [lambda row: A('Delete', _href='#', _class="button btn btn-secondary icon trash icon-trash glyphicon glyphicon-trash", )]

,但字体和间距已关闭。我从页面源中看到<span>标签必须到位,如下所示:

<span class="icon trash icon-trash glyphicon glyphicon-trash"></span>

但我不知道如何进行。

截屏如下:
Screenshot 2

0 个答案:

没有答案