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

onClick is not triggered correctly in MenuItem #387

Closed
UBy opened this issue Mar 4, 2015 · 2 comments
Closed

onClick is not triggered correctly in MenuItem #387

UBy opened this issue Mar 4, 2015 · 2 comments
Labels
component: menu This is the name of the generic UI component, not the React module!

Comments

@UBy
Copy link

UBy commented Mar 4, 2015

I Haven't been able to add a workable onClick callback for a menu item in the LeftNav component.

when I do some debugging in menu-item.js, like this:

_handleOnClick: function(e) {
console.log(this.props.onClick); <----- debug
if (this.props.onClick) this.props.onClick(e, this.props.index);
}

I get the following in the console:
function () { [native code] }

But for some reason the function does nothing when called, not even alert() or console.log()

I have tested it like this:

 menuItems: [
 { route: 'eee', text: '123', iconRightClassName: "md-list"},
 { route: 'get-started', text: 'Get Started', iconClassName: "md-file-upload", onClick:function(ev, index) { console.log("123");} },
     ...
@UBy
Copy link
Author

UBy commented Mar 4, 2015

I can see something has been done for this already: #325, #286
Nevertheless this doesn't work for me...

@UBy UBy closed this as completed Mar 4, 2015
@UBy UBy reopened this Mar 4, 2015
@UBy UBy closed this as completed Mar 4, 2015
@UBy UBy reopened this Mar 4, 2015
@UBy
Copy link
Author

UBy commented Mar 5, 2015

Alright, figured this out. I have to add an onChange(e, index, menuItem) callback on the LeftNav instead of the MenuItem. I should read the documentation a bit better.

@UBy UBy closed this as completed Mar 5, 2015
@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 25, 2022
@zannager zannager added component: menu This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants