Page 1 of 1

Question regarding MenuBar

Posted: 02 Nov 2017, 15:55
by kaho29
I have a question regarding the Menubar.

I am using it in a project I am working on and noticed the following problem. I use disabled state of the items to mark the currently active MenuItem. It works well except for one thing. When I navigate via a Button that just uses the push method of react-router-redux through this.props.history, everything is rerendered correctly, but the MenuItem created by the NestedMenuItem inside the Menubar is not updated and still has disabled set to true for the last active item.

Code: Select all

<Button id="loginWithLabel"
        label="LOG-IN"
        icon="fa-sign-in"
        onClick={() => { this.navigateTo('/login') }} />

navigateTo = (urlPart) => {
    ...
    //navigate to internal URL
    this.props.history.push(urlPart);
    ...
}                            
Every props and states seem to be ok and every render method is called as expected. Only the MenuItem is not updated and still shows disabled: true in its properties and the render method is not called for this component either.

Is that expected behaviour or am I doing something unexpected or wrong?

The MenuItem causing the problem is created in NestedMenuItem.js from line 105:

Code: Select all

_react2.default.createElement(_MenuItem.MenuItem, { items: this.props.item, onItemClick: function onItemClick(event) {
        return _this2.itemClick(event, _this2.props.item);
    }, root: this.props.root, parentMenu: this.props.parentMenu })

Re: Question regarding MenuBar

Posted: 03 Nov 2017, 22:39
by cagatay.civici
We'll check and get back to you.

Re: Question regarding MenuBar

Posted: 16 Nov 2017, 13:22
by mert.sincan
Could you please provide a plunker for us to replicate?
https://plnkr.co/edit/uHHN7wKskRgpHszbPZtj?p=info

Re: Question regarding MenuBar

Posted: 16 Nov 2017, 14:40
by kaho29
I created a simple plunker to showcase the problem. When you klick the button a new Menuitem is added and the disabled state switches from first to second menuitem. As you can see the new item is rendered correctly, but the disabled state stays with the first menuitem.

https://www.dropbox.com/s/xbbd0ju5iquk2 ... j.zip?dl=0

Re: Question regarding MenuBar

Posted: 23 Nov 2017, 15:01
by merve7
Thank you for plunker. We fixed for next version (PrimeReact 1.2.1)

Re: Question regarding MenuBar

Posted: 24 Nov 2017, 17:24
by kaho29
Great, thanks :)