primefaces中是否有可显示禁用commandButton的工具提示的功能。
发布于 2012-03-26 09:50:28
如果您找不到在禁用按钮上显示工具提示的方法,您可以始终尝试用一些
将转换为span
的<h:panelGroup></h:panelGroup>
或使用
将转换为div
的<h:panelGroup layout="block"></h:panelGroup>
发布于 2019-10-09 13:03:35
在这个问题中,@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;
}
为了显示工具提示,您可以创建如下内容:
<p:commandButton id="testButton" disabled="true"
action="yourAction" styleClass="showTooltip" value="Click me!" />
在css文件中添加以下规则:
.ui-state-disabled.showTooltip{
pointer-events: all;
}
如果一个元素同时具有ui-state-disabled
和showTooltip
两个类,则无论如何都会显示工具提示。
发布于 2015-04-21 13:18:33
我想扩展Daniel's answer。您需要在禁用的按钮上插入覆盖块,并在其上应用工具提示。h:panelGroup中的简单包装按钮不会有太大帮助。
<h:panelGroup styleClass="display: inline-block; position: relative;">
<p:commandButton disabled="#{controller.isDisabled()}" ... />
<h:panelGroup styleClass="display: block; height: 100%; width: 100%; position: absolute; top: 0px; left: 0px;"
rendered="#{controller.isDisabled()}"
id="disabledBtnOverlay" />
</h:panelGroup>
<p:tooltip for="disabledBtnOverlay" rendered="#{controller.isDisabled()}" />
https://stackoverflow.com/questions/9868515
复制相似问题