Skip to content

Commit f97a606

Browse files
susanupxpm
authored andcommitted
Update datatables_logic.blade.php
1 parent b40f520 commit f97a606

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/resources/views/crud/inc/datatables_logic.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,20 @@ function formatActionColumnAsDropdown() {
407407
const actionColumnIndex = $('#crudTable').find('th[data-action-column=true]').index();
408408
if (actionColumnIndex === -1) return;
409409
410+
const minimumThreshold = $('#crudTable').data('line-buttons-as-dropdown-threshold');
411+
410412
$('#crudTable tbody tr').each(function (i, tr) {
411413
const actionCell = $(tr).find('td').eq(actionColumnIndex);
414+
const actionButtons = actionCell.find('a.btn.btn-link');
412415
if(actionCell.find('.actions-buttons-column').length) return;
416+
if(actionButtons.length < minimumThreshold) return;
413417
414418
// Wrap the cell with the component needed for the dropdown
415419
actionCell.wrapInner('<div class="nav-item dropdown"></div>');
416420
actionCell.wrapInner('<div class="dropdown-menu dropdown-menu-left"></div>');
417421
418422
// Prepare buttons as dropdown items
419-
actionCell.find('a.btn.btn-link').each((index, action) => {
423+
actionButtons.each((index, action) => {
420424
$(action).addClass('dropdown-item').removeClass('btn btn-sm btn-link');
421425
$(action).find('i').addClass('me-2 text-primary');
422426
});

0 commit comments

Comments
 (0)