-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Add one to current colspan in fixColumns instead of resetting to 2 #1869
base: 2.3
Are you sure you want to change the base?
FIX Add one to current colspan in fixColumns instead of resetting to 2 #1869
Conversation
ee22a35
to
ae3f7db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Couple of small changes
client/src/legacy/GridField.js
Outdated
@@ -176,7 +176,8 @@ $.entwine('ss', function($) { | |||
this.find('.sortable-header').append('<th class="main col-Actions" />'); | |||
this.find('tbody tr').each(function () { | |||
var cell = $(this).find('td:last'); | |||
cell.attr('colspan', 2); | |||
var colspan = cell.attr("colspan") ?? 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var colspan = cell.attr("colspan") ?? 1; | |
var colspan = cell.attr('colspan') ?? 1; |
What is the ?? 1
there for? What scenarios result in there not being a colspan
attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The colspan attribute is not set by default, I've not seen it in use other than in the case of an empty gridfield.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would colspan 2
always be correct when colspan
wasn't already defined?
ae3f7db
to
8d14019
Compare
@@ -176,7 +177,8 @@ $.entwine('ss', function($) { | |||
this.find('.sortable-header').append('<th class="main col-Actions" />'); | |||
this.find('tbody tr').each(function () { | |||
var cell = $(this).find('td:last'); | |||
cell.attr('colspan', 2); | |||
var colspan = cell.attr('colspan') ?? 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var colspan = cell.attr('colspan') ?? 1; | |
// Note we need to add 1 to the current column span, because we're going to add a new column | |
var colspan = cell.attr('colspan') ?? 1; |
client/src/legacy/GridField.js
Outdated
@@ -176,7 +176,8 @@ $.entwine('ss', function($) { | |||
this.find('.sortable-header').append('<th class="main col-Actions" />'); | |||
this.find('tbody tr').each(function () { | |||
var cell = $(this).find('td:last'); | |||
cell.attr('colspan', 2); | |||
var colspan = cell.attr("colspan") ?? 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would colspan 2
always be correct when colspan
wasn't already defined?
In the previous situation, the 'No items found' row would be hardcapped at colspan=2. This change ensures that that row always spans all columns in the table
8d14019
to
3d6b2d9
Compare
Description
In the old situation, the final column in each row would be hardcoded to colspan="2" if the function 'fixColumns' was called. This is required because this function adds an additional column to the table that needs to be filled in. This change removes the hardcoded number and instead adds one to the current colspan of the last cell. This fixes the bug that the 'No items found' row would be capped at two columns even if the table has more.
Manual testing steps
Issues
Pull request checklist