-
-
Notifications
You must be signed in to change notification settings - Fork 618
Add onCellClick for th and column key as argument #100
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
Conversation
e.g. if user wants to to make the entire cell a target for sort toggle
covers th and td
make it easier to identify the exact cell clicked.
}; | ||
if (column.onCellClick) { | ||
cell.onClick = (e) => column.onCellClick(column, column.key, e); | ||
} |
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 the original purpose of onCellClick is only applying to the body cell. If we want apply onCellClick to header cell as well, we should keep the arguments consistent.
/cc @afc163
It seems material-ui only applies onCellClick to body cell too. https://github.com/callemall/material-ui/blob/f2edf58f6e1683ce26f5046ce05a6c9e83b60928/src/Table/Table.js#L159-L186 |
Actually, you already know which column occurs event because you are defining onCellClick on that column. |
This reverts commit 5be42e5.
Will close this for now. If there is demand we can add |
For example, if user wants to trigger sort behavior on any click within the
th
. Can use event to filter unwanted clicks, e.g. filter menu or specific sort direction arrow.Downside is, within
onCellClick
, user can't always assume it is a body cell anymore, though It is easy enough to tell the difference between body and head cells.Also, column key helps user determine the actual cell clicked. As of now, we just know the row and must use the event to know cell. Alternatively, give the user the row and column index like material-ui