Css 使用<;用户界面:重复>;
这个有点复杂。基本上,我使用谷歌的Material Design Lite css,并使用primefaces发出ajax请求来动态添加输入字段Css 使用<;用户界面:重复>;,css,ajax,jsf,material-design-lite,Css,Ajax,Jsf,Material Design Lite,这个有点复杂。基本上,我使用谷歌的Material Design Lite css,并使用primefaces发出ajax请求来动态添加输入字段 <h:commandLink value="+ Add something> <f:ajax listener="#{bean.method()}" execute="@form" process="@form" render="@form" />
<h:commandLink value="+ Add something>
<f:ajax listener="#{bean.method()}"
execute="@form"
process="@form"
render="@form" />
</h:commandLink>
几个月前,我遇到了同样的问题。出现这种情况是因为MDL在HTML呈现期间只应用了一次样式 要修复此问题,必须明确要求MDL重新渲染视图以重新应用样式。为此,必须在AJAX请求的成功状态下调用以下MDL函数:
componentHandler.upgradeAllRegistered()
您的代码应该如下所示:
<h:commandLink value="+ Add something>
<f:ajax listener="#{bean.method()}"
execute="@form"
process="@form"
render="@form"
onevent="function(data){if (data.status === 'success'){componentHandler.upgradeAllRegistered();}}"/>
</h:commandLink>
如果你用h:inputText
替换p:inputText
,它会起作用吗?不幸的是,不是:(那么这个问题与PrimeFaces无关。为你编辑了qyestion我已经尝试过使用这个解决方案,因为我已经在线阅读了它,但不知道如何实现它。这个解决方案非常有效!非常感谢:)
<h:commandLink value="+ Add something>
<f:ajax listener="#{bean.method()}"
execute="@form"
process="@form"
render="@form"
onevent="function(data){if (data.status === 'success'){componentHandler.upgradeAllRegistered();}}"/>
</h:commandLink>