-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 grouping example #1311
Fix grouping example #1311
Conversation
amanmahajan7
commented
Oct 21, 2018
•
edited
Loading
edited
- Fix grouping example adazzale/Demo/Documentation Page Not Found #1348
- Fix cell actions example cell actions example broken #1342
- Allow draggable columns to be frozen
Hey @amanmahajan7 Since this is a minor change we should have master as the base branch rather than next |
@malonecj master does not have the latest code, we should catchup with next and I can create a new PR with master as the base branch |
Add HeaderRowType constant Use column name instead of key for group name
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.
let groupedRows = this.resolver.getGroupedRows(rows, columnName); | ||
let keys = this.resolver.getGroupKeys(groupedRows); | ||
let dataviewRows = this.resolver.initRowsCollection(); | ||
|
||
for (let i = 0; i < keys.length; i++) { | ||
let key = keys[i]; | ||
let isExpanded = this.isRowExpanded(columnName, key); | ||
let rowGroupHeader = {name: key, __metaData: {isGroup: true, treeDepth: columnIndex, isExpanded: isExpanded, columnGroupName: columnName}}; | ||
let rowGroupHeader = {name: key, __metaData: {isGroup: true, treeDepth: columnIndex, isExpanded: isExpanded, columnGroupName: columnName, columnGroupDisplayName}}; |
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.
Added this to show column.name
instead of column.key
in the group row
}; | ||
} | ||
|
||
setScrollLeft(scrollLeft) { |
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 no longer required as HeaderCell
content is wrapped inside a DraggableHeaderCell
@@ -10,11 +10,6 @@ class RowRenderer extends React.Component { | |||
renderBaseRow: PropTypes.func.isRequired | |||
}; | |||
|
|||
setScrollLeft = (scrollBy) => { |
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 not required as we introduced renderBaseRow
import Row from './Row'; | ||
import cellMetaDataShape from 'common/prop-shapes/CellActionShape'; | ||
import * as rowUtils from './RowUtils'; | ||
import RowGroup, { DefaultRowGroupRenderer } from './RowGroup'; |
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.
DefaultRowGroupRenderer
does not exist
|
||
getSelectedRowColumns = (rowIdx) => { | ||
const row = this.getRowByRef(rowIdx); | ||
return row && row.props ? row.props.columns : this.props.columns; |
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 was causing an error for grouped rows
{resizeHandle} | ||
</div> | ||
); | ||
|
||
if (rowType === HeaderRowType.HEADER && column.draggable) { |
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.
Wrapping HeaderCell
content. This has a few benefits
setScrollLeft
is not required inDraggableHeaderCell
. So this works with frozen columns, it was broken before- It works with any header cell renderer
In the future I would like to clean up header rendering logic so we can easily compose them
DraggableHeaderCell(SortableHeaderCell(SimpleHeaderCell or column.headerRenderer))
if (isDragging) { | ||
return null; | ||
} | ||
return connectDragSource(<div ref={node => this.node = node} style={{cursor: 'move'}}>{this.props.renderHeaderCell(this.props)}</div>); |
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.
renderHeaderCell
is not passed as a prop
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 looks good to me