PrimeFaces 6.2 commandButton标题在禁用commandbutton时不起作用 [英] PrimeFaces 6.2 commandButton title not working when commandbutton is disabled

查看:76
本文介绍了PrimeFaces 6.2 commandButton标题在禁用commandbutton时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:JSF 2.2.14,PrimeFaces 6.2

Environment: JSF 2.2.14, PrimeFaces 6.2

我将命令按钮设置如下,当禁用按钮时,标题将在PF6.1中显示(悬停时),但不会在PF6.2中显示

I have my command button set up as below, when the button is disabled, title will show up (when hovered over) in PF6.1, but won't show in PF6.2

<p:commandButton id="removeCmd" icon="fa fa-times" 
             actionListener="#{controller.remove()}" 
             update="@form"
             disabled="#{ontroller.isCommandDisabled()}"                                                          
             style="width: 20px; height:20px;margin-left: 5px;"
             title="#{controller.isCommandDisabled() ? 'Command disabled due to user privilege' : 'remove selected item'}"
             onstart="PF('bui').show(); PF('bar').show();" 
             oncomplete="PF('bui').hide(); PF('bar').hide();"
             styleClass="removeCmd"/>

未禁用按钮时标题显示很好.

Title show up fine when button is not disabled.

有人遇到相同的问题吗?我还尝试将我的p:commandButton包装在h:panelGrid中,并使用p:tooltip,两者都不起作用.

Does anyone encounter the same problem? I also tried to wrap my p:commandButton inside h:panelGrid and use p:tooltip with it, not working either.

更新:在github上创建的问题: https://github .com/primefaces/primefaces/issues/3656

UPDATE: issue created on github: https://github.com/primefaces/primefaces/issues/3656

推荐答案

从本质上来说,我很好奇(我对PrimeFaces中的更改有所了解).如果按钮的标题在6.1到6.2之间不再起作用,那么我开始进行一些分析.在两个PrimeFaces版本中,为按钮生成的html 相同.这使我思考是否也将停止对其他组件的工作.所以我创建了一个简单的页面

By nature I'm curious (and I follow the changes in PrimeFaces a little). If the title of a button does not work anymore between 6.1 and 6.2 I start analyzing a little. The generated html for a button in both PrimeFaces versions is identical. This makes me think whether it would have stopped working for other components as well. So I created a simple page

<p:inputText title="myInput enabled" />
<p:inputText title="myInput disabled" disabled="true"/>

并且使用PrimeFaces 6.1和6.2之间的行为更改是相同的.标题适用于6.1和6.2中的第一个.由于PrimeFaces 6.1和6.2之间存在重大的jquery更改,因此我在Google中发布了禁用输入和按钮的jquery显示标题工具提示".

And the behaviour change between using PrimeFaces 6.1 and 6.2 was the same. Title working for both in 6.1 and only for the first in 6.2. Since there was a major jquery change between PrimeFaces 6.1 and 6.2, I posted 'jquery show title tooltip of disabled inputs and buttons' in google.

其中一个热门是: 显示禁用项目的工具提示

其中引用了一些css(!),它禁用了dom事件,因此没有显示标题.

In it there was a reference to some css(!) that disables dom events and consequently not showing titles.

pointer-events: none;

我打开了浏览器开发人员工具,然后在css选项卡的过滤器部分中放置了指针".当使用6.1时,那里什么都没有,但是在6.2中没有.

I opened my browser developer tool and in the filter part in the css tab, I put 'pointer'. When using 6.1, there was nothing there, but in 6.2 there was.

.ui-state-disabled {
    cursor: default !important;
    pointer-events: none;
}

这似乎来自components.css文件(根据我的浏览器开发人员工具).这不是PrimeFaces存储库中存在的文件,而是通过maven构建PrimeFaces版本时创建的文件:

Which seems to be coming from the components.css file (according to my browser developer tool). This is not a file that exists in the PrimeFaces repository but one that is created when the PrimeFaces release is build via maven:

此处包含的文件之一是

One of the files that is included here is the jquery-ui.css and in it is the piece of css referenced above.

当我在浏览器开发人员工具中禁用了相应的pointer-events: none时,输入和按钮的标题均可见.

When I disabled the corresponding pointer-events: none in my browser developer tool, the titles became visible both for the input and the button.

因此,如果您想覆盖此设置,请将其设置为全部"(或您喜欢的任何其他值).

So if you want to override this, please set this to 'all' (or any other value of your liking).

html .ui-state-disabled {
    pointer-events: all;
}

另请参见

这篇关于PrimeFaces 6.2 commandButton标题在禁用commandbutton时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆