How do you conditionally hide/show or enable/disable menuitems in PrimeFaces?

前端 未结 3 1319
暗喜
暗喜 2021-01-16 02:26

I want to do the following: active o inactive a menuitem with management bean (MB), I want to use properties \"renderer\". But I don\'t Know like do it.

My code is

3条回答
  •  一个人的身影
    2021-01-16 02:51

    To enable or disable (showing it all the time) you must create a boolean variable and you put it in a condition, for example:

    private boolean isDisabled = false; // with the getter and setter
    if( condition)
    {
        isDisabled = true;
    }
    else
    {
        isDisabled = false;
    }
    

    after that, you add in your page the disabled of rendered attribute:

     
    

    But you could also put the condition in the EL line in the answer that uses 'rendered'

提交回复
热议问题