Fix errors when a grouped table is shown #4672
Open
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.
If a table has groups which are all collapsed and the VirtualDomVertical renderer is used, there are some issues scrolling the table:
Example
https://jsfiddle.net/isaraystanz/tpgh5vze/11/
I noticed that RowManager.renderTable() will call VirtualDomVertical.renderRows() => _virtualRenderFill() which triggers GroupRows.virtualRenderFill().
In this function the minWidth is adjusted if there are only group rows causing a horizontal scrollbar to be displayed.
Later in RowManager.renderTable(), the call to RowManager.layoutRefresh() will lead to filtColumns.scaleColumns() to be invoked, which changes the width of the columns.
After this, the columns are thin enough to fit the view but the horizontal scrollbar is still being shown, due to the minWidth that was set.
I added a call to GroupRows.virtualRenderFill() after this, so the minWidth will be adjusted and the horizontal scrollbar disappears.
RowManager._virtualRenderFill() will call row.calcHeight() after rows have been rendered causing Group.outerHeight to be set internally. This is always 0 because the implementation for Group.calcHeight() is empty.
The rowsHeight calculated later will then also be 0 since all groups are collapsed.
When the view is scrolled so far, that the next rows have to be added at the bottom and some have to be removed from the top,
VirtualDomVertical._removeTopRow() tries to sum up row heights until none have to be removed anymore.
Since the height is always 0, all rows are added to a list of removable rows then all are removed.
I added a minimal implementation to Group.calcHeight(), so height will not be 0.
Collapsing/Expanding a group will lead to_virtualRenderFill(), (GroupRows.updateGroupRows () ... => RowManager.reRenderInPosition() ...=> _virtualRenderFill()) which sets scrollTop after rendering. Here the position is not correct due to the groupRow height being empty.
This is fixed by the code from the previous issue.
Is the implementation for GroupRow.calcHeight() empty on purpose?
If so the height may have to be calculated differently.
These problems are also addressed in the github issues #4219 and #4525.