Skip to content

Commit 3799356

Browse files
authored
Merge pull request #5859 from Laravel-Backpack/fix-line-buttons-as-dropdown
fix line buttons dropdown
2 parents c62fd3c + f4b8621 commit 3799356

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/resources/views/crud/components/datatable/datatable_logic.blade.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ functionsToRunOnDataTablesDrawEvent: [],
194194
config.hasDetailsRow = tableElement.getAttribute('data-has-details-row') === 'true' || tableElement.getAttribute('data-has-details-row') === '1';
195195
config.hasBulkActions = tableElement.getAttribute('data-has-bulk-actions') === 'true' || tableElement.getAttribute('data-has-bulk-actions') === '1';
196196
config.hasLineButtonsAsDropdown = tableElement.getAttribute('data-has-line-buttons-as-dropdown') === 'true' || tableElement.getAttribute('data-has-line-buttons-as-dropdown') === '1';
197-
config.lineButtonsAsDropdownMinimum = parseInt(tableElement.getAttribute('data-line-buttons-as-dropdown-minimum')) || 3;
198-
config.lineButtonsAsDropdownShowBeforeDropdown = parseInt(tableElement.getAttribute('data-line-buttons-as-dropdown-show-before-dropdown')) || 1;
197+
config.lineButtonsAsDropdownMinimum = parseInt(tableElement.getAttribute('data-line-buttons-as-dropdown-minimum')) ?? 3;
198+
config.lineButtonsAsDropdownShowBeforeDropdown = parseInt(tableElement.getAttribute('data-line-buttons-as-dropdown-show-before-dropdown')) ?? 1;
199199
config.responsiveTable = tableElement.getAttribute('data-responsive-table') === 'true' || tableElement.getAttribute('data-responsive-table') === '1';
200200
config.exportButtons = tableElement.getAttribute('data-has-export-buttons') === 'true';
201201
// Apply any custom config
@@ -887,8 +887,10 @@ function formatActionColumnAsDropdown(tableId) {
887887
if (!table) return;
888888
889889
// Get configuration
890-
const minimumButtonsToBuildDropdown = parseInt(table.getAttribute('data-line-buttons-as-dropdown-minimum')) || 3;
891-
const buttonsToShowBeforeDropdown = parseInt(table.getAttribute('data-line-buttons-as-dropdown-show-before-dropdown')) || 1;
890+
const minAttr = table.getAttribute('data-line-buttons-as-dropdown-minimum');
891+
const showBeforeAttr = table.getAttribute('data-line-buttons-as-dropdown-show-before-dropdown');
892+
const minimumButtonsToBuildDropdown = minAttr !== null ? parseInt(minAttr) : 3;
893+
const buttonsToShowBeforeDropdown = showBeforeAttr !== null ? parseInt(showBeforeAttr) : 1;
892894
893895
// Get action column
894896
const actionColumnIndex = $('#' + tableId).find('th[data-action-column=true]').index();

0 commit comments

Comments
 (0)