Skip to content
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

[Table] Send event object after click, hover, hoverOut on cell. #3002

Merged
merged 1 commit into from
Feb 5, 2016

Conversation

MaronMariusz
Copy link
Contributor

Since I couldn't find onClick event on my table I made something own. If you like it, merge it ;) Cheers!

(if you have some solution to make this PR useless let me know!)

  • modified: src/table/table-body.jsx
  • modified: src/table/table.jsx

@oliviertassinari
Copy link
Member

@MaronMariusz That sounds like a good idea to propagate the event object.

@@ -384,16 +384,16 @@ const TableBody = React.createClass({

_onCellClick(e, rowNumber, columnNumber) {
e.stopPropagation();
if (this.props.onCellClick) this.props.onCellClick(rowNumber, this._getColumnId(columnNumber));
if (this.props.onCellClick) this.props.onCellClick(rowNumber, this._getColumnId(columnNumber), e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it would be better to use event instead of e.

That would also be good to have the event as the first argument. However, using event as the first parameters would introduce a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for reply.

event instead of e sounds better you are right, but what I have seen in this component author used just e as variable name so I wanted to keep with this idea.

Moreover I agree that moving this param on the first place can break something so that's why I pushed it as the last item ;)

Personally it helps me so much in order to make some event delegations :)

Cheers!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I have seen in this component author used just e as variable name so I wanted to keep with this idea.

I understand, we are slowing rolling out from e to event.

Moreover I agree that moving this param on the first place can break something so that's why I pushed it as the last item ;)

Don't do it in this PR. That would be a breaking change.

@oliviertassinari
Copy link
Member

@MaronMariusz Could you take into account my comments? I think that we can merge this PR then.

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed PR: Needs Review labels Jan 26, 2016
	modified:   src/table/table-body.jsx
	modified:   src/table/table.jsx
@MaronMariusz
Copy link
Contributor Author

Hi, I changed e to event and we can :shipit:

@oliviertassinari oliviertassinari removed the PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI label Feb 5, 2016
@oliviertassinari
Copy link
Member

@MaronMariusz That looks good, thanks!
However, expect the argument order to change in future release, we will try to stay coherent and to keep event as the first parameter (#2957).

oliviertassinari added a commit that referenced this pull request Feb 5, 2016
[Table] Send event object after click, hover, hoverOut on cell.
@oliviertassinari oliviertassinari merged commit a972c92 into mui:master Feb 5, 2016
@zannager zannager added the component: table This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants