简体   繁体   English

在ap:tabView中启用ap:tab已被禁用,而未更新所有表单(primefaces)

[英]Enable a p:tab in a p:tabView already disabled without updating all form (primefaces)

How to update a tab inside a tabView which is already disabled. 如何更新已禁用的tabView内的选项卡。

I've tried to update only the header by the class name (.ui-tabs-nav) , but nothing happens. 我试图通过类名(.ui-tabs-nav)仅更新标头,但是什么也没有发生。 I've also sought to add a div between the tabView and Tab to update it by id or use simply a style, but JSF does not render this one. 我还试图在tabViewTab之间添加一个div以通过id或仅使用一种样式进行更新,但是JSF不会呈现此样式。

I have found a solution to doing that directly using JavaScript, by changing the class value. 我已经找到了一种通过更改类值直接使用JavaScript的解决方案。

When JSF generate the HTML code, it fills every class tag in those tabs by values. JSF生成HTML代码时,它将按值填充这些选项卡中的每个类标记。 If we observe an enabled tab we notice that the class contains ui-state-default ui-corner-top and a disabled class contains ui-state-default ui-corner-top ui-state-disabled 如果观察到启用的选项卡,我们会注意到该类包含ui-state-default ui-corner-top而禁用的类包含ui-state-default ui-corner-top ui-state-disabled

to select the desired tab i used this expression 选择所需的选项卡,我使用了此表达式

$('ul.ui-tabs-nav li:eq(n)')

and to change the class value 并更改班级价值

1- $('ul.ui-tabs-nav li:eq(n)').attr('class', 'ui-state-default ui-corner-top ui-state-disabled');  

2- $('ul.ui-tabs-nav li:eq(n)').attr('class', 'ui-state-default ui-corner-top'); 

Another alternative is to use : 另一种选择是使用:

widgetVar tag inside the primefaces tabView with PF('tabView').enable(n) and PF('tabView').disable(n) 带有PF('tabView').enable(n)PF('tabView').disable(n)的primefaces tabView内的widgetVar标签

n is the tab Rank starting from 0 n是标签,排名从0开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM