File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/resources/views/crud/inc Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff 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 });
You can’t perform that action at this time.
0 commit comments