Strange behavior with picklist inside tabview

UI Components for JSF
Post Reply
mehdisinger
Posts: 1
Joined: 06 Sep 2012, 17:06

06 Sep 2012, 17:32

Hi,

I have a TabView containing a Picklist:

My xtml page:

Code: Select all

<h:form>
            <p:tabView var="auditorium" value="#{auditoriumController.auditoriums}">
                <p:ajax event="tabChange" listener="#{auditoriumController.onTabChange}"/>
                <p:tab title="#{auditorium.number}">
                    <p:fieldset id="auditoriumInfoFieldset" legend="Auditorium Info" toggleable="true" style="width: 45%; float: left">
                        <p:panelGrid>
                            ...
                        </p:panelGrid>
                    </p:fieldset>
                    <p:fieldset id="associatedDevicesFieldset" legend="Associated devices" toggleable="true" style="width: 45%;">
                        <p:pickList value="#{auditoriumController.devices}" var="device" itemValue="#{device}" itemLabel="#{device.manufacturer}" converter="deviceConverter">
                            <f:facet name="sourceCaption">Available</f:facet>  
                            <f:facet name="targetCaption">Associated</f:facet>
                            <p:ajax event="transfer" listener="#{auditoriumController.onDeviceTransfer}" />
                        </p:pickList>
                    </p:fieldset>
                </p:tab>
            </p:tabView>
        </h:form>
My backing bean:

Code: Select all

@ManagedBean(name = "auditoriumController")
@ViewScoped
public class AuditoriumController implements Serializable {

    @PostConstruct
    public void postConstruct() {
        devices = new DualListModel<>();
        auditoriums = auditoriumFacade.findAll();
        if (auditoriums != null && !auditoriums.isEmpty()) {
            setSelectedAuditorium(auditoriums.get(0));
            populateDeviceList();
        }
    }

    public void onTabChange(TabChangeEvent event) {
        setSelectedAuditorium((Auditorium) event.getData());
        System.out.println("onTabChange : " + selectedAuditorium);
        populateDeviceList();
    }

    private void populateDeviceList() {
        // Filling the dual list
    }
    
    public void onDeviceTransfer(TransferEvent event) { 
        for(Object item : event.getItems()) {
            Device device = deviceFacade.find(((Device) item).getId());
            // Doing my stuff with the items
            }
        }
    }
}
My converter (just in case)

Code: Select all

@FacesConverter(forClass=Device.class, value="deviceConverter")
public class DeviceConverter implements Converter {
    
    @Override
    public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
        Device device = new Device();
        device.setId(Long.valueOf(string));
        return device;
    }

    @Override
    public String getAsString(FacesContext fc, UIComponent uic, Object o) {
        return String.valueOf(((Device) o).getId());
    }
    
}
The problem is that my method onTabChange is never called when the picklist is present. The method onDeviceTransfer is called correctly.
If I remove the picklist in my xtml page it works fine...
Any idea about what could cause this issue? Am I doing something wrong?

Thanks for your precious help !

Mehdi
Primefaces 3.4 - JSF 2.2.0 - Mojarra 2.1.6 - Glassfish 3.1.2

KonstrictorMan
Posts: 4
Joined: 13 Aug 2012, 02:46

30 May 2013, 05:38

Hi there,

Have you resolved this problem?... i have the same exact situation

It's driving me nuts ! :shock:

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 May 2013, 07:59

If you have the Same situation, please try 3.5(.x)

And your specs are weird. Mojarra 2.1.6 is not jsf 2.2.0

Try upgrading mojarra to...

KonstrictorMan
Posts: 4
Joined: 13 Aug 2012, 02:46

31 May 2013, 06:29

I'm using Primefaces 3.5.. but the problem persists... i gotta try the new 3.5.5 and see what happens

Last night i found the issue clearly identified on this link

https://code.google.com/p/primefaces/is ... t=&id=5280

Apparently this issue has not been resolved...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests