-
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
Defining the ref callback as a bound method #1353
Conversation
@@ -558,10 +558,9 @@ class ReactDataGrid extends React.Component { | |||
}; | |||
|
|||
getHeaderRows = () => { | |||
let rows = [{ ref: (node) => this.row = node, height: this.props.headerRowHeight || this.props.rowHeight, rowType: HeaderRowType.HEADER }]; | |||
const rows = [{ height: this.props.headerRowHeight || this.props.rowHeight, rowType: HeaderRowType.HEADER }]; |
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.
ref: this.row
is not used anywhere. Header row defines its own ref.
render() { | ||
let headerRows = this.props.headerRows || [{ref: (node) => this.row = node}]; | ||
let EmptyRowsView = this.props.emptyRowsView; | ||
const { headerRows } = this.props; |
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.
/>); | ||
return ( | ||
<HeaderRow | ||
key={row.rowType} |
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.
Not sure why was key
a function (row.ref
is defined in ReactDataGrid.js
)
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.
Looks good to me
* Defining the ref callback as a bound method * Fix unit tests
https://reactjs.org/docs/refs-and-the-dom.html