Reputation: 780
Well i'm making a web, and i using primeface, but i was trying to do the example from the showcase of the datagrid with the commandButton command, but after 1 day of trying I fail, but i make the same code with dataTab and work so i'm lost i put the code if any of you can help me a little.
(technology used is tomcat 7, jsf 2.1 and primeface 3.2)
Here is the code of the dataTab
<p:dataTable id="juego" var="juego" value="#{juegoBean.files}">
<p:column headerText="Model" style="width:24%">
<h:outputText value="#{juego.id}" />
</p:column>
<p:column headerText="Year" style="width:24%">
<h:outputText value="#{juego.idUser.mail}" />
</p:column>
<p:column style="width:4%">
<p:commandButton id="selectButton" update=":form:detalle" oncomplete="juegoDialog.show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{juego}" target="#{juegoBean.seleccionadoFile}" />
</p:commandButton>
</p:column>
</p:dataTable>
and this is the code of the dataGrid
<p:dataGrid var="juego" value="#{juegoBean.files}" columns="3"
rows="12" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="12,24,36">
<p:panel header="#{juego.id}" style="text-align:center">
<h:panelGrid style="width:100%">
<!--
<p:graphicImage value="/images/cars/.jpg"/>
<h:outputText value="#{juego.idUser.user}" />
<p:commandButton id="selectButton" update=":form:detalle" oncomplete="juegoDialog.show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{juego}" target="#{juegoBean.seleccionadoFile}" />
</p:commandButton>
</h:panelGrid>
</p:panel>
</p:dataGrid>
and this is the dialog how i'm trying to update
<p:dialog header="Information del archivo" widgetVar="juegoDialog" modal="true">
<p:outputPanel id="detalle" layout="block">
<p:tabView id="tabView">
<p:tab id="general" title="General">
<div id="descripcion">
<h3>Descripcion del juego</h3><br />
<p style="font-size: small;">#{juegoBean.seleccionadoFile.infoFile.description}</p><br />
</div>
<div id="categoria">
<h3>Categorias del Juego</h3><br />
<p style="font-size: small;">
</p><br />
</div>
<div id="clave">
<h3>Palabras clave</h3> <br />
<p style="font-size: small;">#{juegoBean.seleccionadoFile.infoFile.motCles}</p><br />
</div>
<div id="subido">
<h3>Esta archivo fue subido el:</h3> <br />
<p style="font-size: small;">#{juegoBean.seleccionadoFile.infoFile.dateUpload}</p>
</div>
</p:tab>
<p:tab id="imagen" title="Imagenes del juego">
<div class="largo">
<ui:repeat var="imagen" value="#{juegoBean.seleccionadoFile.imageCollection}">
<img title="" alt="" src="#{imagen.root}" />
</ui:repeat>
</div>
</p:tab>
<p:tab id="estadistica" title="Estadistica">
<div>
<h3>Descargado: </h3><br />
<p style="font-size: small;">#{juegoBean.seleccionadoFile.telecharge}</p><br />
</div>
<div>
<h3> Reputacion: </h3><br />
<p style="font-size: small;"></p><br />
</div>
<div>
<h3> Ultima vez descargado: </h3><br />
<p style="font-size: small;">#{juegoBean.seleccionadoFile.infoFile.dateDernierTelechargement}</p><br />
</div>
</p:tab>
<p:tab id="descargar" title="Descargar">
<h3> Descargar link </h3> <br/>
<br/>
<p style="font-size: small;"><a title="" href="#{juegoBean.seleccionadoFile.adresse}" onclick="#{juegoBean.actualizarDescarga()}">Descargar</a></p>
<br/>
</p:tab>
</p:tabView>
</p:outputPanel>
</p:dialog>
Upvotes: 0
Views: 147
Reputation: 11
You have to add <p:colum>
after <p:datagrid>
.
<p:dataGrid var="juego" value="#{juegoBean.files}" columns="3"
rows="12" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="12,24,36">
<p:colum>
<p:panel header="#{juego.id}" style="text-align:center">
<h:panelGrid style="width:100%">
<!-- -->
<p:graphicImage value="/images/cars/.jpg"/>
<h:outputText value="#{juego.idUser.user}" />
<p:commandButton id="selectButton" update=":form:detalle" oncomplete="juegoDialog.show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{juego}" target="#{juegoBean.seleccionadoFile}" />
</p:commandButton>
</h:panelGrid>
</p:panel>
<p:colum>
</p:dataGrid>
Upvotes: 1