17
我在我的代碼中使用PrimeFaces <p:ajax>
標記。我們如何在更新父組件的ajax調用中排除子組件的更新?如何排除父組件的ajax更新中的子組件?
我在我的代碼中使用PrimeFaces <p:ajax>
標記。我們如何在更新父組件的ajax調用中排除子組件的更新?如何排除父組件的ajax更新中的子組件?
如果您至少使用PrimeFaces 3.3,那麼您可以使用PrimeFaces Selectors。這允許您使用PrimeFaces ajax組件的process
和update
屬性中的jQuery CSS selector syntax。
例如:
<h:form>
<h:inputText ... />
<h:inputText ... />
<h:inputText ... styleClass="noupdate" />
<h:inputText ... />
<h:inputText ... />
<p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>
該實施例將更新除了具有在客戶端class="noupdate"
輸入的整個形式。
如果你想更新某個組件的所有兒童除一人外,由周圍部件的ID(或類或......)
<h:form id="form">
<h:panel id="myPanel">
<h:inputText ... />
<h:inputText ... />
<h:inputText ... styleClass="noupdate" />
</h:panel>
<h:inputText ... />
<h:inputText ... />
<p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>
<p:commandButton ... update="@(#form\:myPanel :not(.noupdate))"/>
替代「形式」只要確保你使用完整的客戶端ID。
謝謝你的回答!我不知道可以在Primefaces更新屬性中使用jQuery選擇器。 – Pranjali
不客氣。 – BalusC
該語法是否會在頁面上提交其他表單? –