是否有一个功能可显示工具提示,用于在primefaces中禁用commandButton.
Dan*_*iel 12
如果您没有找到在禁用按钮上显示工具提示的方法,您可以随时尝试将其包装起来
<h:panelGroup></h:panelGroup> 这会变成 span
或者
<h:panelGroup layout="block"></h:panelGroup> 这会变成 div
并尝试将工具提示应用于包装器...
在这个问题中解释了@Kukeltje 为什么工具提示在禁用的 commandButton 上不起作用:PrimeFaces 6.2 commandButton title not working when commandbutton is disabled
.ui-state.disabled如果其 disabled 属性设置为 true,则该类将添加到按钮:
.ui-state-disabled {
cursor: default !important;
pointer-events: none;
}
Run Code Online (Sandbox Code Playgroud)
为了无论如何显示工具提示,您可以创建如下内容:
<p:commandButton id="testButton" disabled="true"
action="yourAction" styleClass="showTooltip" value="Click me!" />
Run Code Online (Sandbox Code Playgroud)
在您的 css 文件中添加以下规则:
.ui-state-disabled.showTooltip{
pointer-events: all;
}
Run Code Online (Sandbox Code Playgroud)
如果一个元素同时具有两个类ui-state-disabled,showTooltip则无论如何都会显示工具提示。