2

我正在使用带有 contextMenu 的树,这是代码:

      <p:contextMenu id="campaignPlaneTreeContextMenu" for="campaignPlanetree" >
          <p:menuitem value="New Camapign" disabled="#{projectCampaignManagementMB.campaignOptionsFlag}" />
          <p:menuitem value="Assign" disabled="#{projectCampaignManagementMB.FSTOptions}" />
          <p:menuitem value="Copy campaign" disabled="#{projectCampaignManagementMB.FSTOptions}"/>
          <p:menuitem value="Paste Campaign" disabled="#{projectCampaignManagementMB.pasteOptionCampaignFlag}"/>
          <p:menuitem value="Delete" disabled="#{projectCampaignManagementMB.FSTOptions}" />
          <p:menuitem value="Import Tests" disabled="#{projectCampaignManagementMB.campaignOptionsFlag}" />
      </p:contextMenu>
      <p:tree id="campaignPlanetree"
                    value="#{projectCampaignManagementMB.root}" var="node"
                    selectionMode="single"
                    selection="#{projectCampaignManagementMB.selectedNode}"
                     dynamic="true">

          <p:ajax event="select" listener="#{projectCampaignManagementMB.onCampaignPlaneNodeSelect}" update=":campaignForm:addCampaignBtn :campaignForm:renameCampaignBtn :campaignForm:importCampaignBtn :campaignForm:deleteCampaignBtn :campaignForm:importCampaignDlg :campaignForm:campaignPlaneTreeContextMenu" /> 

          <p:treeNode  value="#{node}">
              <h:outputText value="#{node}" />
          </p:treeNode>
           .....

托管豆:

if(selectedNode.getData() instanceof Campaign){// when a user select a tree node the contextmenu item are disabled and enabled

          setCampaignOptionsFlag(false);
        ....   
  }

如果没有 disabled 属性,一切都很好,但是添加它后,上下文菜单会立即消失。

4

1 回答 1

2

我发现当您将光标放在每个节点的箭头上时,我的意思是在所选树节点的左侧,上下文菜单不会立即消失。

但是在最后一个树级别(叶子)中,您不会看到箭头,因为节点不可扩展所以它肯定是一个 primefaces 错误

于 2012-10-20T09:22:36.003 回答