在更改父属性时清除依赖属性值
Clear dependent attribute values on changing parent attribute
我有一个父属性 OrganizationId 和 attributes- ProjectId ,它依赖于 OrganizationId 。因此,在 clearing/updating OrganizationId ProjectId 应该是 removed.In 当前清除 OrganizationId 的情况下,我们无法 select 任何 ProjectId,尽管现有的 ProjectId 值仍然显示在页面上。
<af:inputComboboxListOfValues id="OrganizationCode"
popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.OrganizationCode.hints.label}"
value="#{bindings.OrganizationCode.inputValue}"
label="#{bindings.OrganizationCode.hints.label}"
model="#{bindings.OrganizationCode.listOfValuesModel}"
required="#{bindings.OrganizationCode.hints.mandatory}"
columns="#{bindings.OrganizationCode.hints.displayWidth}"
shortDesc="#{bindings.OrganizationCode.hints.tooltip}"
searchDesc="#{bindings.OrganizationCode.hints.tooltip}"
autoSubmit="true"
partialTriggers="DeliveryName"
valueChangeListener="#{CreatePickWaveBean.onOrganizationCodeChange}"
binding="#{CreatePickWaveBean.organizationCode}">
<af:inputListOfValues id="projCostingProjectNumberId"
popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.ProjCostingProjectNumber.hints.label}"
value="#{bindings.ProjCostingProjectNumber.inputValue}"
label="#{wshpickreleaseuiBundle['ColAttr.ProjectCostingProjectNumber.ProjectPVO.ProjectCostingProjectNumber']}"
model="#{bindings.ProjCostingProjectNumber.listOfValuesModel}"
required="#{bindings.ProjCostingProjectNumber.hints.mandatory}"
columns="#{bindings.ProjCostingProjectNumber.hints.displayWidth}"
shortDesc="#{bindings.ProjCostingProjectNumber.hints.tooltip}"
autoSubmit="true"
binding="#{CreatePickWaveBean.pjcProjectNumber}"
valueChangeListener="#{CreatePickWaveBean.onPjcNumberChange}">
public void onOrganizationCodeChange(ValueChangeEvent valueChangeEvent) {
updateEVH(getOrganizationCode());
private void updateEVH(EditableValueHolder evh) {
if (evh != null)
evh.setSubmittedValue(null);
}
尝试重置值或设置值null for inputListOfValues OrganizationId changed
您已经将 projectId 组件的绑定设置为
"#{CreatePickWaveBean.pjcProjectNumber}"
所以你可以在 ProjectId
的 Value change listener 方法中使用下面的代码
this.getPjcProjectNumber().setValue(null);
或
this.getPjcProjectNumber().resetValue();
我有一个父属性 OrganizationId 和 attributes- ProjectId ,它依赖于 OrganizationId 。因此,在 clearing/updating OrganizationId ProjectId 应该是 removed.In 当前清除 OrganizationId 的情况下,我们无法 select 任何 ProjectId,尽管现有的 ProjectId 值仍然显示在页面上。
<af:inputComboboxListOfValues id="OrganizationCode"
popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.OrganizationCode.hints.label}"
value="#{bindings.OrganizationCode.inputValue}"
label="#{bindings.OrganizationCode.hints.label}"
model="#{bindings.OrganizationCode.listOfValuesModel}"
required="#{bindings.OrganizationCode.hints.mandatory}"
columns="#{bindings.OrganizationCode.hints.displayWidth}"
shortDesc="#{bindings.OrganizationCode.hints.tooltip}"
searchDesc="#{bindings.OrganizationCode.hints.tooltip}"
autoSubmit="true"
partialTriggers="DeliveryName"
valueChangeListener="#{CreatePickWaveBean.onOrganizationCodeChange}"
binding="#{CreatePickWaveBean.organizationCode}">
<af:inputListOfValues id="projCostingProjectNumberId"
popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.ProjCostingProjectNumber.hints.label}"
value="#{bindings.ProjCostingProjectNumber.inputValue}"
label="#{wshpickreleaseuiBundle['ColAttr.ProjectCostingProjectNumber.ProjectPVO.ProjectCostingProjectNumber']}"
model="#{bindings.ProjCostingProjectNumber.listOfValuesModel}"
required="#{bindings.ProjCostingProjectNumber.hints.mandatory}"
columns="#{bindings.ProjCostingProjectNumber.hints.displayWidth}"
shortDesc="#{bindings.ProjCostingProjectNumber.hints.tooltip}"
autoSubmit="true"
binding="#{CreatePickWaveBean.pjcProjectNumber}"
valueChangeListener="#{CreatePickWaveBean.onPjcNumberChange}">
public void onOrganizationCodeChange(ValueChangeEvent valueChangeEvent) {
updateEVH(getOrganizationCode());
private void updateEVH(EditableValueHolder evh) {
if (evh != null)
evh.setSubmittedValue(null);
}
尝试重置值或设置值null for inputListOfValues OrganizationId changed
您已经将 projectId 组件的绑定设置为 "#{CreatePickWaveBean.pjcProjectNumber}" 所以你可以在 ProjectId
的 Value change listener 方法中使用下面的代码this.getPjcProjectNumber().setValue(null);
或
this.getPjcProjectNumber().resetValue();