PrimeFaces动态命令按钮和上下文菜单



请帮助我解决如何通过Java动态添加CommandButtons的动态ContextMenu(左键点击)的问题。CommandButtons的计数是动态的(最小50),但ContextMenu总是相同的:

Column column = ...
ContextMenu contextmenu = ...
CommandButton button1 = new CommandButton();
//todo addContextMenu
CommandButton button2 = new CommandButton();
//todo addContextMenu
...
CommandButton button50 = new CommandButton();
//todo addContextMenu
column.getChildren().add(button1);
column.getChildren().add(button2);
...
column.getChildren().add(button50);
PS我使用Primefaces 5.3, Primefaces Extensions 4.0, Mojarra 2.2.5。提前感谢!

CommandButtons通过左键单击激活它们的操作,因此您可能会寻找MenuButtons,它具有由左键单击触发的菜单和箭头,显示动态菜单的可用性。

菜单的编程创建在选项卡下的Primefaces菜单展示中描述。

最新更新