简体   繁体   English

p:pickList不更新源和目标

[英]p:pickList doesn't update the source and target

I have been accessing the p:picklist for the first time and I am facing a issue where I am not able to get source and target values updated as in the p:picklist ui. 我第一次访问p:picklist ,我遇到了一个问题,我无法像p:picklist ui那样更新源和目标值。 I am using list of DualListModel<String> . 我正在使用DualListModel<String> Here is the code.. 这是代码..

Please help me. 请帮我。 Thanks for the help! 谢谢您的帮助!

code.xhtml

<p:dataTable value="#{updateSiteObj.dsList}" var="pickListObjDS" >
    <p:column headerText="DS">
        <p:pickList id="pojoPickListDSID" value="#{pickListObjDS}" var="ds"  itemValue="#{ds}" itemLabel="#{ds}"  showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" style="border-color: white!important" onTransfer="ajaxSubmit3()">  
            <f:facet name="sourceCaption">Available</f:facet>  
            <f:facet name="targetCaption">To be removed</f:facet>  
        </p:pickList>
        <p:remoteCommand action="#{updateSiteObj.onDSTransfer}" name="ajaxSubmit3"/>
    </p:column>
</p:dataTable>

UpdateSite.java

@ManagedBean(name = "updateSiteObj")
@SessionScoped
public class UpdateSite {

    private List<DualListModel<String>> dsList = new ArrayList<DualListModel<String>>();

    public List<DualListModel<String>> getDsList() {
        return dsList;
    }

    public void setDsList(List<DualListModel<String>> dsList) {
        this.dsList = dsList;
    }

    public String updateSiteDetails() {

        ds.add(sg.getPrimaryDSID());
        if (sg.getSecondaryDSID() != null) {
            ds.add(sg.getSecondaryDSID());
        }

        System.out.print("DS:" + sg.getPrimaryDSID() + "=>" + sg.getSecondaryDSID());
        DualListModel<String> tempDS = new DualListModel<String>();
        tempDS.setSource(ds);
        dsList.add(tempDS);
        return "someSite?faces-redirect=true";
    }

    public void onDSTransfer() {
        System.out.print("DSTransfer");
        for (DualListModel<String> str1 : dsList) {
            System.out.print("RemovedLBEntry:");
            for (String dsName1 : str1.getTarget()) {
                System.out.print("RemovedLB:" + dsName1);
            }
        }
    }
}

When I try to call onDSTransfer after moving the values from source panel to target panel in picklist UI doesn't show any value from target. 当我在picklist UI中将值从源面板移动到目标面板后尝试调用onDSTransfer ,不显示目标的任何值。

Add update="@all" in p:remoteCommand . p:remoteCommand添加update="@all"

You are doing a ajax call and not updating your UI. 您正在进行ajax调用而不是更新UI。

<p:remoteCommand action="#{updateSiteObj.onDSTransfer}" name="ajaxSubmit3" update="@all"/>

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

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