Dialog not poping up on datatable singlerow selection

UI Components for JSF
Post Reply
ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

23 Aug 2010, 10:29

I created a datatable following the single row selection showcase example, however my dialog does not get popped instead it is dispayed inline. It also results in javascript error which prevents further interaction with the datatable, here is my code:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Hyphen</title>
    </h:head>
    <h:body>
        <h:form id="usersform">
            <p:dataTable value="#{users.users}" var="item" id="usersList" paginator="true" rows="10" selection="#{users.user}"
                         selectionMode="single" update="usersform" dynamic="false" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15" onselectComplete="userDialog.show()">
                <f:facet name="header">
                    All Users
                </f:facet>
                <p:column sortBy="#{item.userid}">
                    <f:facet name="header">
                        <h:outputText value="User ID"/>
                    </f:facet>
                    <h:outputText value="#{item.userid}"/>
                </p:column>
                <p:column sortBy="#{item.username}">
                    <f:facet name="header">
                        <h:outputText value="Username"/>
                    </f:facet>
                    <h:outputText value="#{item.username}"/>
                </p:column>
                <p:column sortBy="#{item.password}" rendered="false">
                    <f:facet name="header">
                        <h:outputText value="Password"/>
                    </f:facet>
                    <h:outputText value="#{item.password}"/>
                </p:column>
                <p:column sortBy="#{item.issuperuser}">
                    <f:facet name="header">
                        <h:outputText value="Issuperuser"/>
                    </f:facet>
                    <h:outputText value="#{item.issuperuser}"/>
                </p:column>
                <p:column sortBy="#{item.firstname}">
                    <f:facet name="header">
                        <h:outputText value="Firstname"/>
                    </f:facet>
                    <h:outputText value="#{item.firstname}"/>
                </p:column>
                <p:column sortBy="#{item.lastname}">
                    <f:facet name="header">
                        <h:outputText value="Lastname"/>
                    </f:facet>
                    <h:outputText value="#{item.lastname}"/>
                </p:column>
            </p:dataTable>

            <p:dialog header="User Detail" widgetVar="userDialog" resizable="false" width="200" showEffect="clip" hideEffect="fold">
                <h:panelGrid id="display" columns="2" cellpadding="4">

                    <f:facet name="header">
                        Edit User Details
                    </f:facet>

                    <h:outputLabel value="Userid:" for="userid" />
                    <h:inputText id="userid" value="#{users.details.userid}" disabled="true" title="Userid" required="true" requiredMessage="The Userid field is required."/>
                    <h:outputLabel value="Username:" for="username" />
                    <h:inputText id="username" value="#{users.details.username}" disabled="true" title="Username" />
                    <h:outputLabel value="Issuperuser:" for="issuperuser" />
                    <h:selectOneMenu id="issuperuser" value="#{users.details.issuperuser}">
                        <f:selectItems value="#{users.superUserOptions}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="Firstname:" for="firstname" />
                    <h:inputText id="firstname" value="#{users.details.firstname}" title="Firstname" />
                    <h:outputLabel value="Lastname:" for="lastname" />
                    <h:inputText id="lastname" value="#{users.details.lastname}" title="Lastname" />

                    <h:commandButton id="back" value="Back" action="#{users.list}"/>
                    <h:commandButton id="update" value="Update" action="#{users.update}"/>

                </h:panelGrid>

            </p:dialog>
        </h:form>
    </h:body>
</html>
And my backing bean:

Code: Select all

public class usersMBean {

    @EJB
    private UsersSessionBean usersSessionBean;
    private Users user;

    /** Creates a new instance of usersMBean */
    public usersMBean() {
    }

    /**
     * Returns list of customer objects to be displayed in the data table
     * @return
     */
    public List<Users> getUsers() {
        return usersSessionBean.retrieve();
    }

    /**
     * @return the user
     */
    public Users getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(Users user) {
        this.user = user;
    }

    /**
     * Returns the selected Customer object
     * @return
     */
    public Users getDetails() {
        //Can either do this for simplicity or fetch the details again from the
        //database using the User ID
        return getUser();
    }

    /**
     * Action handler - user selects a User record from the list
     * (data table) to view/edit
     * @param guarantor
     * @return
     */
    public String showDetails(Users user) {
        this.setUser(user);
        return "USERDETAILS";
    }

    /**
     * Action handler - update the changes in the Guarantor object to the
     * database
     * @return
     */
    public String update() {
        setUser(usersSessionBean.update(getUser()));
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Sucessful", "Record successfully saved!"));
        return "USERUPDATED";
    }

    protected SelectItem[] superUserOptions;

    public SelectItem[] getsuperUserOptions() {
        SelectItem[] options = new SelectItem[2];
        options[0] = new SelectItem("1", "Yes");
        options[1] = new SelectItem("0", "No");
        return options;
    }
}
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2

ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

23 Aug 2010, 12:17

Strange, strange, strange. The Dialog message pops up in firefox without errors, but now I get one pop for each row of data, even with one single row click on the data table. So for four rows of data I get four Dialog displayed. In IE I don't get any Popped Dialogs.
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2

ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

23 Aug 2010, 12:41

I was able to eliminate the multiple Dialog problem by changing: update="id of form" to update="id of grid". But none of these work with IE. Anyone with ideas?
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2

ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

23 Aug 2010, 12:49

The error I get in IE is:

javax.el.PropertyNotFoundException

This is coming from from the xhtml page and refering to the backing bean. My guess is that this selection="#{users.user}" is not being executed.
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Aug 2010, 13:04

You are using an unstable 2.2. development build which is not working on IE at the moment.

ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

23 Aug 2010, 14:30

Ok. Do you have timeline for a stable release?
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2


ayobod1
Posts: 38
Joined: 20 Jul 2010, 18:31

24 Aug 2010, 09:29

Thanks callahan.
Primefaces 2.2.M1-SNAPSHOT, Mojarra 2.0.2 (FCS b10), Glassfish 3.0.1, Netbeans 6.9.1, JSF 2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 71 guests