shymonk/django-datatable

how to implement edit/delete button in each row

navsoftdev opened this issue · 1 comments

I want to add edit and delete link with id

i use
edit = tables.LinkColumn('item_edit', args=[A('pk')], orderable=False)

but got error NameError: name 'tables' is not defined

fgau commented

from table.columns import Column, LinkColumn, DatetimeColumn, Link, ImageLink

action = LinkColumn(header=u'action', links=[ImageLink(
viewname='portal.users.views.detail',
image='/static/images/ic_edit_black_24px.svg',
image_title='Edit',
args=['edit', A('id')]),
ImageLink(
viewname='portal.users.views.detail',
image='/static/images/ic_delete_black_24px.svg',
image_title='Delete',
args=['delete', A('id')]),
], searchable=False)