-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
DataGrid: Group header column width fix #5815
Open
tesar-tech
wants to merge
1
commit into
master
Choose a base branch
from
dev/datagrid-showheadergroupcaptions-messes-with-layout
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
I don't think we should modify the Width here. What will happen when the user-defined the width on their side?
I think we should just change the Bootstrap CSS when the grouping is enabled on a table.
Here is an example from my comment in the ticket, as a reference:
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.
@David-Moreira agree?
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.
"What will happen when the user-defined the width on their side?" -> that's exactly what the bug is about. When user defines width it inherits after the first column that was defined with
HeaderGroupCaption
. Now it tries to squeeze 3 (or what ever count) columns into the size of 1...With width disabled on header group, users can still set the width by defining it by the width of the individual items (which is exactly what is done in the bug report).
The css fix messes up the layout on bigger screens for example (isn't stretching itself to 100%)
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.
I think @stsrki meant the user defining the width in a CSS file meaning that your solution would only fix by overriding any Width explicitly defined as a Parameter and not as a css defined rule targeting that column, is this not the case?
So if @stsrki solution with css also fixes the issue in the same way yours do. Then his solution has the advantage to also work over user's defined css. I'd personally take that approach if it works with no other issues.
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.
Additionally, I'd make it clear somewhere that this feature does not work properly with explicitly defined widths and make sure that the user knows what will happen.
Somethign along this lines:
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.
Yes, even with my solution user can still get there (un)intended width as style or by class. There is no reason to do it by style - because user has dedicated Width property for that. If set by class, we can mitigate the effect by setting the width
unset
instead of null.The css solution has side effects:
No header:
Header with issue:
When removing the 100% width (css fix)
My fix:
The css fix remove the 100% width, which is not intended (I guess) and will act differently on bigger screens. Maybe not important - you tell me.
My fix also doesn't keep the layout the same. But that is due to the fact that the stretching is now governed by the top header columns (header groups) - there are 4 of them and the stretching is happening proportionally to them, not to the lower header columns (as without the header group). Keeping the intended size of columns is only possible when the whole thing is not stretching (basically the css fix).
(My code still need some fixes, because it works with the column instance..)
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.
This is the problem because a lot of users actually use Style directly, so for them, this fix might break their UIs.
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.
I agree, In my onion, never ever assume what the user should do. There might be a myriad of reasons why he would set the width through regular styling... and it's perfectly reasonable to do so by styling.
So unless we deem something as unsuported by the framework/product we're providing, then if it's available the user might use it and we might want to handle it.
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.
Yeah, right..
So we have two solutions, both with breaking change.
What about letting users to do their own styling on the header group cell?
something like:
And instead of taking the styling from the first
DataGridColumn
withHeaderGroupCaption="Personal Info"
, it would just take the one withIsHeaderGroup
. This might actually simplify few things along the line.Not a quick fix, but imo the cleanest solution...