使用 MenuModel 支持的菜单进行 Primefaces 布局导航
使用 PrimeFaces,我想根据用户与包含在相同页面东部布局单元中的菜单(以编程方式创建的 MenuModel)的交互来更新/刷新页面中央布局单元。据我所知,这是不可能的,但很可能是错误的。谢谢!
subMenu = new Submenu();
subMenu.setLabel("Sales");
subMenu.setIcon("ui-icon ui-icon-home");
-
private String currentPage; //holds identifier of current content panel
-
<!-- navigation panel -->
<p:layoutUnit position="west" resizable="false" size="216">
<ui:include src="./includes/navigationMenu.xhtml" />
</p:layoutUnit>
<!-- content panel -->
<p:layoutUnit position="center">
<ui:include src="/views/#{navigationBean.currentPage}.xhtml" />
</p:layoutUnit>
谢谢!
Using PrimeFaces, I want to update/refresh a pages central layout unit based on user interaction with a menu (programmatically created MenuModel) that's included in the same pages east layout unit. From what I can tell, this is not possible, but very well could be wrong. Thanks!
subMenu = new Submenu();
subMenu.setLabel("Sales");
subMenu.setIcon("ui-icon ui-icon-home");
-
private String currentPage; //holds identifier of current content panel
-
<!-- navigation panel -->
<p:layoutUnit position="west" resizable="false" size="216">
<ui:include src="./includes/navigationMenu.xhtml" />
</p:layoutUnit>
<!-- content panel -->
<p:layoutUnit position="center">
<ui:include src="/views/#{navigationBean.currentPage}.xhtml" />
</p:layoutUnit>
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这只是一个问题:为什么要以编程方式创建菜单?
除此之外,几乎一切皆有可能:尝试将
ui:include
包含到具有 id 的表单组件中(比方说 myFormId),并尝试每次更新此表单选择子菜单项;好吧,让我们以编程方式做到这一点:您可以在这里找到 menuItem API
It's just a question: Why do you create a menu programmatically?
Other than that almost everything it's possible: try to include the
ui:include
into a form component with an id (let's say myFormId) and try to update this form every time a submenu item is selected; Ok so let's do that programmatically:You can find here the menuItem API
我实现了一个侦听器..
将其添加到 MenuItem 以及对模板刷新()的调用...
添加了刷新方法...
我真的不喜欢这个解决方案,但它比替代方案更好,标记中具有无法测试的菜单创建逻辑。
I implemented a listener..
added it to the MenuItem as well as a call to the the templates refresh()...
added the refresh method...
I really don't care for this solution, but it's better than the alternative, having untestable menu creation logic in markup.