rihcfaces 树中的上下文菜单

发布于 2024-10-11 02:21:58 字数 132 浏览 5 评论 0原文

我在丰富的面孔树组件(rich:tree)中有上下文菜单。在我的树中,我列出了文件夹和子文件夹。通过使用上下文菜单,我可以编辑文件夹和子文件夹的数据。我有单独的方法来编辑文件夹和子文件夹文件夹。我如何在 cotnextmenu 单击操作中调用此方法?

I have context menu in rich faces tree component(rich:tree).In my tree i had listed folders and sub folders.By using context menu i can edit datas of the folders and sub folders.I have separate methods for edit folder and sub folders.How can i call this methods in cotnextmenu click action?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

惜醉颜 2024-10-18 02:21:58

您可以为编辑文件夹和子文件夹操作设置 2 个不同的 ,并在上下文菜单的 javascript 中将它们称为 onclick 条件。

<rich:menuItem value="Your Context Menu Item" onclick="menuFunction();"></rich:menuItem>
<a4j:jsFunction name="editFolder" action="#{yourFolder.Edit}"/>
<a4j:jsFunction name="editSubFolder" action="#{yourSubFolder.Edit}"/>

以及脚本函数

function menuFunction(){
  if(subFolderNodeValue){    //Here subFolderNodeValue is the value of node, you can set it using nodeSelectionListner
     editSubFolder();
  }else{
     editFolder();
  }
}

You can have 2 different <a4j:jsFunction> for both of your edit folders and subfolders action and call them onclick condition in javascript of contextmenu.

<rich:menuItem value="Your Context Menu Item" onclick="menuFunction();"></rich:menuItem>
<a4j:jsFunction name="editFolder" action="#{yourFolder.Edit}"/>
<a4j:jsFunction name="editSubFolder" action="#{yourSubFolder.Edit}"/>

And script function

function menuFunction(){
  if(subFolderNodeValue){    //Here subFolderNodeValue is the value of node, you can set it using nodeSelectionListner
     editSubFolder();
  }else{
     editFolder();
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文