Datagrid not working

UI Components for JSF
Post Reply
moessi91
Posts: 20
Joined: 29 Mar 2011, 10:11
Location: Austria, Upper Austria

12 Apr 2011, 10:38

Hey I m trying to add a datagrid to my current project but it just wan t work right....

Code: Select all

<p:dialog header="Bilder" widgetVar="BilderDialog" resizable="true" height="800" width="600">
                <p:dataGrid var="bild" value="#{handleShowBilder.bilder}" columns="3"
                            rows="12" paginator="true" effect="true"
                            paginatorTemplate="{CurrentPageReport}
                            {FirstPageLink} {PreviousPageLink} {PageLinks}
                            {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                            rowsPerPageTemplate="9,12,15">

                    <p:column>
                        <p:panel header="#{bild.kuenstler.sNachname}" style="text-align:center">
                            <h:panelGrid columns="1" style="width:100%">
                                <p:graphicImage value="#{bild.sBildPfad}"/>

                                <h:outputText value="#{bild.sTitel}" />

                                <p:commandLink update="Show_Bild_Detail" oncomplete="ShowOnePicDialog.show()"
                                               title="View Detail">
                                    <p:graphicImage value="/images/search.png"/>
                                    <f:setPropertyActionListener value="#{bild}"
                                                                 target="#{handleShowBilder.selectedPic}" />
                                </p:commandLink>
                            </h:panelGrid>
                        </p:panel>
                    </p:column>
                </p:dataGrid>

                <p:dialog header="Bild Detail" widgetVar="ShowOnePicDialog" width="200" height="175">
                    <p:outputPanel id="Show_Bild_Detail" style="text-align:center;" layout="block">

                        <p:graphicImage value="#{handleShowBilder.selectedPic.sBildPfad}"/>

                        <h:panelGrid  columns="2" cellpadding="5">
                            <h:outputLabel for="Show_Bild_Detail_Titel" value="Titel: " />
                            <h:outputText id="Show_Bild_Detail_Titel" 
                                          value="#{handleShowBilder.selectedPic.sTitel}"/>
                        </h:panelGrid>
                    </p:outputPanel>
                </p:dialog>
            </p:dialog>
Here i got some Problems... First of all the Dialog can not be resized.
Secondly the Pics are not Shown?!? But the path is okay, I checked it. (It´s an Absolute Path that is saved in the database)
At next when I press the button to view the details an then It hasn´t got the data...
Here is the bean:

Code: Select all

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import database.dbZugriff;
import information.ormapping.Bild;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author CTK
 */
@ManagedBean
@RequestScoped
public class HandleShowBilder
{
    private List<Bild> bilder;
    dbZugriff dbConn = new dbZugriff();
    private Bild selectedPic;
    /** Creates a new instance of HandleShowBilder */
    public HandleShowBilder()
    {
//Gets all the Pics from the Database
        bilder = dbConn.getAllBilder();

    }

    /**
     * @return the bilder
     */
    public List<Bild> getBilder() {
        return bilder;
    }

    /**
     * @param bilder the bilder to set
     */
    public void setBilder(List<Bild> bilder) {
        this.bilder = bilder;
    }

    /**
     * @return the selectedPic
     */
    public Bild getSelectedPic() {
        return selectedPic;
    }

    /**
     * @param selectedPic the selectedPic to set
     */
    public void setSelectedPic(Bild selectedPic) {
        this.selectedPic = selectedPic;
    }

}
Please help, I m dieing i just can t find the mistake.

lg
-------------------------
Austrian Student, learning Primefaces
Using:
Primefaces 4.0
JSF 2.2
Glassfish 4.0

moessi91
Posts: 20
Joined: 29 Mar 2011, 10:11
Location: Austria, Upper Austria

14 Apr 2011, 09:37

nobody knows st??
-------------------------
Austrian Student, learning Primefaces
Using:
Primefaces 4.0
JSF 2.2
Glassfish 4.0

User avatar
maple_shaft
Posts: 58
Joined: 10 Mar 2011, 19:49

14 Apr 2011, 13:31

I suggest using the Firefox plugin called Firebug. It is an incredible tool that allows you to see what HTML and stylesheets are being spit out from your page. This will help you locate why the p:graphicImage is not displaying your image.

You seem to be doing everything right, you are not updating the dialogs directly...

As far as you pressing the button to get the data, I am not sure exactly what you are talking about. Did you try placing a breakpoint in selectedPic to make sure that it is being called and set properly on the server?

Another thing to help is to strip out the bells and whistles, take out the paginator and try it on barebones features first. That helps eliminate potential causes to your problems.

Another thing I would suggest is instead of putting all of these components in one form, try placing a form inside of each dialog individually. I have noticed that seems to fix a lot of weird issues.
First Primefaces Application: PrimeFaces 2.2.1, Mojarra 2.0.4, Tomcat 7.08 - JBoss 6

Second Primefaces Application: Primefaces 3.0 FINAL (<-- AWESOME!), Mojarra 2.1.2, Spring 3 with Spring Security and Spring EL Resolver, Tomcat 6

moessi91
Posts: 20
Joined: 29 Mar 2011, 10:11
Location: Austria, Upper Austria

15 Apr 2011, 07:51

i just saved the pics from now on in a relative directory /upload/.../pic.jpg
now it´s working.. it just didn´t like the absolute path
:)
but the dialog is still not :/ ill try you hints thx :)
-------------------------
Austrian Student, learning Primefaces
Using:
Primefaces 4.0
JSF 2.2
Glassfish 4.0

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests