Primefaces picklist dualList object become empty

jQuery UI Widgets
Post Reply
neliosam
Posts: 2
Joined: 30 Oct 2015, 02:08

04 Mar 2017, 16:24

The pickList dualList object become empty when the object loads.

This is the pick list definition

Code: Select all

<p:pickList id="queuesPickList" 
            value="#{manageApplications.dualListQueuesToBeAddedToTheApplication}" 
            var="queueToAdd" itemLabel="#{queueToAdd}" itemValue="#{queueToAdd}">
</p:pickList>
The dualList object being used is composed by two List of Strings

Code: Select all

private List<String> queuesSouce = new ArrayList<>();
private List<String> queuesTarget = new ArrayList<>();
private DualListModel<String> dualListQueuesToBeAddedToTheApplication;

The list load properly and I am able to manage object one side another.
Image

Until this part everything looks good. The source and target objects loads successfully and the pick list is functional. Immediately after creating the dualList I am listing the contents for source and target and both are there.

There is a button down below to save the changes made by calling an actionListener.

Code: Select all

<p:commandButton value="SAVE" id="saveQueuesButton" 
                 actionListener="#{manageApplications.saveQueuesToTheApplication()}"
                 oncomplete="PF('dlgAddQueuesToApplication').hide();"
                 update="addQueuesToApplicationPanel">
</p:commandButton>
The actionListener for now is just printing the values from the dualList object.

Code: Select all

public void saveQueuesToTheApplication() {       
            System.out.println(this.dualListQueuesToBeAddedToTheApplication.getTarget());
    }
Now both, .target() and .souce() are empty. There are zero object in there.

Image
Reading the Primefaces documentation it says that the converter is needed to deal with you own type. Since I am using plain vanilla List of Strings that is the native object for the pickList component I didn't bother to build the converter class.

What Am I doing wrong?

best regards, Neliosam

neliosam
Posts: 2
Joined: 30 Oct 2015, 02:08

04 Mar 2017, 23:31

There was nothing wrong with the code. The issue was related with the scope.

The pickList was being used in a modal dialog window and somehow this was not reflecting the changes into the dualList component.

I have removed the component from the dialog window and added to a that is only rendered when needed using the rendered=#{booleanCondition}

I cannot explain exactly what are the restrictions when using a modal dialog window, but it was preventing the component from updating the variable.

Hope this help someone else facing the same issue!
best regards,
Neliosam

SebastianG
Posts: 4
Joined: 01 Jun 2018, 11:03

31 Jan 2019, 08:15

I am facing exactly the same issue. Picklist on a modal dialog used by the PF DialogFramework.
It is empty after submitting the form.
That makes it completly unusable for me.
Is there any workaround?

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests