I have the below code, but find that the headerText doesn't show. Any advice?
<p:dataTable var="toDoList" value="#{dtView}" tableStyle="width:auto" >
<p:columnGroup type="header">
<p:row><p:column headerText="#{toDoList.schoolScrn}">
<p:outputLabel value="#{toDoList.schoolScrn}" />
</p:column></p:row>
</p:columnGroup>
<p:column>
<p:dataTable var="info" value="#{toDoList.infoList}" >
<p:column >
<h:outputText value="#{info}" />
</p:column>
</p:dataTable>
</p:column>
</p:dataTable>
Related
I can not correctly view the contents of a column with selectManyCheckbox in p:dataTable.
Here my .xhtml:
<h:form id="projAccess" enctype="multipart/form-data">
<p:dataTable tableStyle="width:auto" id="i_dtb2" var="p" value="#{comBean.l_uSrcRes}" paginator="true" rows="5" rowsPerPageTemplate="5,10"
paginatorPosition="bottom">
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="User" />
<p:column rowspan="2" headerText="Asset" />
<p:column colspan="6" headerText="Roles" />
<p:column rowspan="2" colspan="2" headerText="Action" />
</p:row>
<p:row>
<p:column headerText="Project Manager"></p:column>
<p:column headerText="Project Manager Deputy"></p:column>
<p:column headerText="Business Analyst"></p:column>
<p:column headerText="Functional Analyst"></p:column>
<p:column headerText="Technical Analyst"></p:column>
<p:column headerText="Developer"></p:column>
</p:row>
</p:columnGroup>
<p:column>
<h:outputText value="#{p.usercd}" />
</p:column>
<p:column>
<h:outputText value="#{p.asset}" />
</p:column>
<p:column colspan="6">
<h:panelGroup layout="block" >
<p:selectManyCheckbox columns="6" value="#{p.rolesList}">
<f:selectItems value="#{comBean.l_roles}" var="role" itemLabel="#{role}" itemValue="#{role}" />
</p:selectManyCheckbox>
</h:panelGroup>
</p:column>
<p:column>
<p:commandButton action="#{comBean.m_updateAccess}" ajax="false" icon="ui-icon-pencil">
<f:setPropertyActionListener value="#{p}" target="#{comBean.f_selectedUser}" />
<f:param name="area" value="project" />
</p:commandButton>
</p:column>
<p:column>
<p:commandButton action="#{ubean.m_deleteUser}" ajax="false" icon="ui-icon-trash">
<f:setPropertyActionListener value="#{p}" target="#{comBean.f_selectedUser}" />
<f:param name="area" value="project" />
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
Here the result:
How can I adapt content to header columns?
You are using tableStyle="width:auto" in your p:dataTable.
Removing this will align the checkboxes to its respective columns but you can notice that the columns are still a little bit misaligned.
To solve this, you can add style="padding:0px;" on your checkbox p:column.
Your code will look something like this.
<p:dataTable id="i_dtb2" var="p" value="#{comBean.l_uSrcRes}" paginator="true" rows="5" rowsPerPageTemplate="5,10"
paginatorPosition="bottom">
// other codes
<p:column colspan="6" style="padding:0px;">
// other codes
</p:column>
// other codes
</p:dataTable>
On another note, if your functional specification allows it, you can remove [Project Manager, Project Manager Deputy, etc] headers, since your are displaying them right next to the checkboxes.
You will have to remove p:columnGroup and set the headerText to their respective columns with "Roles" as headerText for your checkBox column.
Hope this helps.
I have a dataTable in my page, and I need update in single row after any event. For example, one click in button. Please any tips?
I would like to do this using only the features of Primefaces and jsf is this possible?
<h:form id="formDtable" prependId="false">
<p:dataTable id="surveyDt"
value="#{surveyCtr.veicLazyDataModel}"
var="veiculos"
scrollRows="100"
scrollable="true"
liveScroll="true"
scrollHeight="430"
emptyMessage=""
rowKey="#{veiculos.seqID}"
rowIndexVar="row"
lazy="true"
style="font-size: 10px;" >
<f:facet name="header">
<p:outputLabel value="Teste Lazy BD" class="fontTituloTabela"/>
</f:facet>
<p:column headerText="Vehicle ID" >
<h:outputText value="#{veiculos.vehicleID}" />
</p:column>
<p:column headerText="Vehicle Type Code" >
<h:outputText value="#{veiculos.vehicleTypeCode}" />
</p:column>
<p:column headerText="Code" >
<h:outputText value="#{veiculos.fltCode}" />
</p:column>
<p:column headerText="Branch Code" >
<h:outputText value="#{veiculos.branchCode}" />
</p:column>
<p:column headerText="Air Steer" >
<h:outputText value="#{veiculos.AirSteer}" />
</p:column>
<p:column headerText="Rec Air Drive" >
<h:outputText value="#{veiculos.AirDrive}" />
</p:column>
<p:column headerText="Rec Air Free" >
<h:outputText value="#{veiculos.AirFree}" />
</p:column>
<p:column headerText="Rec Air Spare" >
<h:outputText value="#{veiculos.AirSpare}" />
</p:column>
<p:column headerText="Qtde Spare" >
<h:outputText value="#{veiculos.qtdSpares}" />
</p:column>
<p:column headerText="tipo de Controle" >
<h:outputText value="#{veiculos.vehicleMType}" />
</p:column>
<p:column headerText="Update" >
<p:commandButton id="btnupdatet" icon="ui-icon ui-icon-pencil"
update="formDtable:**row(index 0 ????)**">
</p:commandButton>
</p:column>
I try to make a data table group of PrimeFaces. All goes well. The number of columns is correct, colspan= "#{asignaturaController.nombrePruebasEscritas1.size()} but the name of each test does not show and the object pointed to is full. I tried everything.
Anyone have any idea?
This is my result.
but I need the names of "Pruebas" over the "pruebas"
<h:form id="form-tablapruebasescritas1"
renderer="#{asignaturaController.nombrePruebasEscritas1.size() != 0}">
<p:dataTable var="player"
value="#{asignaturaController.alumnos}"
id="tablapruebasescritas1"
style="margin-top:40px"
sortOrder="ascending">
<f:facet name="header">
1ยช Evaluacion
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="Alumno" />
<p:column colspan="#{asignaturaController.nombrePruebasEscritas1.size()}"
headerText="Pruebas" />
</p:row>
<p:row>
<ui:repeat value="#{asignaturaController.nombrePruebasEscritas1}"
var="yea">
<p:column headerText="#{yea}" />
</ui:repeat>
</p:row>
</p:columnGroup>
<p:column>
<h:outputText value="#{player.nombre}" />
</p:column>
<p:columns value="#{asignaturaController.nombrePruebasEscritas1}"
var="year">
<h:outputText value="#{player.getNotaParaTabla(year)}" />
</p:columns>
</p:dataTable>
</h:form>
Can we use a simple subtable inside another subtable?
I tried to use like this, but html is not generated.
I can get this done by using ui:repeat or p:dataGrid, but the issue is that the generated data table must be able to be exported to Excel & PDF with p:dataExporter. That is not supported in primefaces if we use it with anything other than dataTable.
Please help.
<p:dataTable id="tbl" value="#{storeReportsTransfer.drows}" var="i" >
<f:facet name="header">
<h:outputLabel value="Department Issue Report "/>
<h:outputLabel value="#{storeReportsTransfer.fromDepartment.name}"/>
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column headerText="Department" />
<p:column headerText="Category" />
<p:column headerText="Item" />
<p:column headerText="Rate" />
<p:column headerText="Total" />
</p:row>
</p:columnGroup>
<p:subTable value="#{i.categoryBillRows}" var="cbr" >
<f:facet name="header">
<h:outputText value="#{i.department.name}" />
</f:facet>
<p:column >
</p:column>
<p:column>
<h:outputText value="#{cbr.category.name}" />
</p:column>
<p:column>
<p:subTable value="#{cbr.itemBillRows}" var="ibr" >
<p:column>
<h:outputText value="#{ibr.item.name}" />
</p:column>
<p:column>
<h:outputText value="#{ibr.bill.netTotal}" />
</p:column>
<p:column>
<h:outputText value="#{ibr.bill.grantTotal}" />
</p:column>
</p:subTable>
</p:column>
<p:columnGroup type="footer">
<p:row>
<p:column footerText="Totals: " style="text-align:right"/>
<p:column footerText="#{cbr.bill.netTotal}" />
</p:row>
</p:columnGroup>
</p:subTable>
</p:dataTable>
<h:form id="main_form">
<p:treeTable var="catalog" value="#{catalogSelectBean.root}" lazy="true" selection="#{myView.selectedCatalogNode}" selectionMode="single">
<p:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{catalog.name}" />
</p:column>
<p:column width="100">
<f:facet name="header">
<h:outputText value="Desc"/>
</f:facet>
<h:outputText value="#{catalog.description}"/>
</p:column>
</p:treeTable>
<!-- The problem commandButton below-->
<p:commandButton action="#{myView.updateProductListForSelectedCatalog}"
update=":main_form:selectProductTable" value="Bring products">
</p:commandButton>
<!-- The problem commandButton above-->
<p:dataTable id="selectProductTable" var="product" value="#{myView.productDataModel}" paginator="true" selection="#{myView.selectedProduct}" >
<f:facet name="header">
Product Selection
</f:facet>
<p:column selectionMode="single" />
<p:column headerText="name">
<h:outputText value="#{product.name}" />
</p:column>
</p:dataTable>
<p:commandButton action="#{myView.setSelectedProductToForm}"
update="main_form"
value="Set">
</p:commandButton>
</h:form>
the problem commandButton does not fire action, if i had selected something in selectproducttable.