Fixed #2839 by creating an empty first column #2891
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This may sound like a bodge, but I'll try to prove my point on how this first empty column is important 😅
When I start to look at the #2839 issue I tried to solve it with javascript, soon I realized it would be very hard because the button were being added as an inner text of the first column, some times the first column was a text (with href), sometimes it was the plus sign to the details row, or even the checkbox for bulk editing.
I found out this solution because at first, I didn't notice the problem because the CRUD I was using as an example had enabled bulk actions, which has a
blank_first_column
, therefore the modal trigger was being added to this first empty column (also, by always adding this blank first column it's no longer necessary on bulk actions).This first empty column allows it to handle both plus button to details row and the data tables button to the modal. I made some changes to the css so that column is not going to appear if there is neither one. I also made small changes to the css to align the checkboxs:
There was also unnecessary padding on non ordering columns, causing odd spacing on the table

Before:
Now:
Before (crud with few columns):
Now:
There is only one downside on this, there's always the empty first row, even when it's not needed.

Anyway, I think it worth 🤷♂️
I think I tested all the possibilities, everything's working nice.
This is not a breaking change, but I think @tabacitu needs to give his opinion on this.