web2py: Replace Smartgrid standard delete button

爷,独闯天下 提交于 2019-12-11 16:53:52

问题


I wanted to replace the standard delete button in Smartgrid. Here's what I attempted to do:

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()

Problems:

1) I can't get the icon-trash glyph/icon to display
2) How do I position the new button at the end of the row, eventually replacing the standard delete button

Screen shot follows:

Edit 1
I managed to make the glyph show with the following links:

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

but the font and spacing are off. I can see from the page source that <span> tags must be in place, like the following:

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

but I dont know how to proceed.

Screenshot follows:

来源:https://stackoverflow.com/questions/54285012/web2py-replace-smartgrid-standard-delete-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!