Base solution for your next web application
Open Closed

bug in showing datatables action column #6852


User avatar
0
p.j.keukens created

Hi,

When there is only one action in the action menu, in my case an open button. The action button is not shown, it only shows when there are two items in the action menu.

cause: datatables.record-actions.js

var _createRowAction = function (record, field, tableInstance) {
        if (field.items && field.items.length > 1) {
            return _createButtonDropdown(record, field, tableInstance);
        } else if (field.element) {
            var $singleActionButton = _createSingleButton(record, field);
            if ($singleActionButton != "") {
                return $singleActionButton.clone(true);
            }
        }
        return "";
    }

change

if (field.items && field.items.length > 1) {

to:

if (field.items && field.items.length > 0) {

2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    see https://github.com/aspnetzero/aspnet-zero-core/issues/367#issuecomment-321570835

  • User Avatar
    0
    p.j.keukens created

    Ahh okay I see, sorry for that.