p:selectCheckboxMenu uncheckAll 不工作

p:selectCheckboxMenu uncheckAll not working

我有:

<p:commandLink action="#{analyticsController.cleanFleet}"
     update="filtersForm-heatmap"
     onclick="PF('wvHeatmapOrganization').uncheckAll();
              PF('wvHeatmapOrganization').selectValue(null);"
     styleClass="btnCleanAnalytics">
         <h:outputText value="#{msg['ANALYTICS-clear']}" />
         <i class="pi pi-trash"></i>
</p:commandLink>

和 selectCheckBoxMenu:

<p:selectCheckboxMenu id="organizations"
       value="#{analyticsController.refOrganizationsSelected}"
       filter="true"
       filterMatchMode="contains"
       multiple="true"
       scrollHeight="250"
       widgetVar="wvHeatmapOrganization"
       showCheckbox="true" styleClass="customInput manymenu-advanced" >
             <f:selectItems value="#{analyticsController.userOrganizations}"
                            var="organization"
                            itemLabel="#{(organization.commercialName eq null) ?  null :  '[ '.concat(organization.id).concat('] ').concat(organization.name) } "
                            itemValue="#{organization.id}"/>
                               <p:ajax event="change" process="@this"/>
                               <p:ajax event="change" listener="#{analyticsController.addOrganizations()}"/>
                               <p:ajax event="change"  listener="#{analyticsController.updateFilters()}"/>
</p:selectCheckboxMenu>

我需要清除没有任何选择的组件,我的实际结果是这样的:

Actual result

你能帮帮我吗?我如何清理所选项目

如果您想清除当前选中的项目,您可以在后台使用您的 commandLink 中的操作清除“refOrganizationsSelected”列表,稍后更新 selectCheckboxMenu 组件。

例如城市:

<h:form id="citiesForm">

    <p:commandLink action="#{helloWorld.clean}"
                   update="organizations"
                   styleClass="btnCleanAnalytics">
        <h:outputText value="Clear" />
    </p:commandLink>


    <p:selectCheckboxMenu id="organizations"
                          value="#{helloWorld.citiesSelected}"
                          filter="true"
                          filterMatchMode="contains"
                          multiple="true"
                          scrollHeight="250"
                          widgetVar="wvHeatmapOrganization"
                          showCheckbox="true" styleClass="customInput manymenu-advanced" >
        <f:selectItems value="#{helloWorld.cities}" />
    </p:selectCheckboxMenu>
</h:form>

和后端:

 public void clean() {

    citiesSelected = new ArrayList<>();
}

之后selectCheckboxMenu将没有任何选中项。