I'm trying to get value from 7 classes, for 7 columns
for interval one, interval two and so on for each student I have >
but the data table get's empty, but Java code is working fine.
I think the problem in html code tags
here is:
</h:form>
<h:form id="hesham1">
<p:scrollPanel style="width:100%;height:100%">
<p:dataTable var="car" value="#{tableBean.carsSmall}" id="hesham" encoding="windows-1256" dir="rtl" emptyMessage="لا يوجد بيانات او تأكد من البيانات المستعلم عنها">
<f:facet name="header">
الاستعلام عن صف 2-10
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="اسم الطالب"/>
<p:column rowspan="2" headerText="التاريخ" />
<p:column colspan="3" headerText="الحصة الاولى" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الثانية" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الثالثة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الرابعة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة الخامسة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة السادسة" style="text-align: center;"/>
<p:column colspan="3" headerText="الحصة السابعة" style="text-align: center;"/>
</p:row>
<p:row>
<p:column headerText="المعلم" >
<h:outputText value="#{car.teachers}" />
</p:column>
<p:column headerText="الماده" >
</p:column>
<p:column headerText="الحالة" >
<h:outputText value="#{car.state}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval2.teachers2}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval2.state2}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval3.teachers3}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval3.state3}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval4.teachers4}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval4.state4}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval5.teachers5}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval5.state5}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval6.teachers6}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval6.state6}" />
</p:column>
<p:column headerText="المعلم" >
<h:outputText value="#{interval7.teachers7}" />
</p:column>
<p:column headerText="الماده" />
<p:column headerText="الحالة" >
<h:outputText value="#{interval7.state7}" />
</p:column>
</p:row>
</p:columnGroup>
<f:facet name="footer">
اجمالي عدد الاستعلامات #{fn:length(tableBean.carsSmall)}
</f:facet>
</p:dataTable>
</p:scrollPanel>
<br />
<h:commandButton value="طباعة التقرير" type="button"
icon="ui-icon-print">
<p:printer target="hesham" />
</h:commandButton>
</h:form>
Um.. you simply don't have a table body here. Everything you have is an enormous header, incorrectly referencing the iteration variable and a giant footer.
See this example for how it's done properly, the p:columnGroup only enclosing the header:
<p:dataTable id="salesTable" var="sale" value="#{tableBean.sales}">
<f:facet name="header">
Sales/Profits of Manufacturers
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="Manufacturer" />
<p:column colspan="2" headerText="Sales" />
</p:row>
<p:row>
<p:column headerText="Sales Count" />
<p:column headerText="Profit" />
</p:row>
</p:columnGroup>
<p:column>
#{sale.manufacturer}
</p:column>
<p:column>
#{sale.lastYearProfit}%
</p:column>
</p:dataTable>
Related
JSF2.2 project deployed on the Wildfly 8.2.1, I am using the primefaces 6.2. When following code is diplayed on the browser it does not show any result even not the header.
diplayResult.xthml
<h:form id="form">
<div style="border: 1">
<h:messages globalOnly="true" errorClass="err" warnClass="warn"
infoClass="info"></h:messages>
<h:messages globalOnly="false" errorClass="err" warnClass="warn"
infoClass="info"></h:messages>
</div>
<h:panelGrid>
<h:outputLabel id="quantity1"> Line:</h:outputLabel>
<h:message for="quantity1"></h:message>
<h:inputText id="quantity"
value="#{dActivityRelatedController.quantity}"></h:inputText>
<h:message for="quantity" errorClass="err" warnClass="warn"
infoClass="info"></h:message>
<h:commandButton
action="#{dActivityRelatedController.getDndActivitySetupList()}"
value="list"></h:commandButton>
</h:panelGrid>
</h:form>
<h:form id="form2">
<p:dataTable var="activitySetup" value="#{dActivityRelatedController.activitySetupList}">
<f:facet name="header">
Activity Setup List
</f:facet>
<p:columnGroup type="header">
<p:row>
<p:column />
<p:column />
<p:column colspan="2" headerText="------Import Dem------" />
<p:column colspan="2" headerText="------Import Det------" />
<p:column colspan="2" headerText="------Export Dem------" />
<p:column colspan="2" headerText="------Export Det------" />
<p:column headerText="status" />
</p:row>
<p:row>
<p:column headerText="Last Year" />
<p:column headerText="This Year" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="From Activity Grp" />
<p:column headerText="To Activity Grp" />
<p:column headerText="" />
</p:row>
</p:columnGroup>
<p:column>
</p:column>
<p:column>
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
<p:column>
<h:outputText value="#{activitySetup.IMP_ACT_GROUP}" />
</p:column>
</p:dataTable>
</h:form>
JSF basic tags are working, as below code.
<h:form id="datatableform">
<h:dataTable
value="#{dActivityRelatedController.activitySetupList}"
var="activitySetup">
<h:column>
<f:facet name="header">From Activity Grp</f:facet>
#{activitySetup.IMP_ACT_GROUP}
</h:dataTable>
</h:form>
When I check the diplayed page using firebug, then the complete primefaces code is displayed on the browser that is written on the diplayResult.xthml. That should be converted into equivalent html tags
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 am new to primefaces. I have one datatable in my application. In that for 3 columns i need to merge some rows. That row count will be generated dynamically based on the data. If I tried to use rowspan in that particular column tag, it additionally created blank cells and the total datatable format is changed. How to do merge that datarows in primefaces. For reference, I am attaching the design and code.
Xhtml code:
<f:facet name="header">
<h:outputText value="Date"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_date}" />
</p:column>
<p:column style="font-size:12px;width:73px;" >
<f:facet name="header">
<h:outputText value="Slot"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_slot}" />
</p:column>
<p:column style="font-size:12px;width:73px;" >
<f:facet name="header">
<h:outputText value="Number of Resources Required"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_noresources}" />
</p:column>
<p:column headerText="Select" id="hSelect" style="font-size:12px;width:60px;">
<p:selectBooleanCheckbox id="Booleanchkbox" onclick="{dtstep2_tab1.select='true'}" >
<p:ajax listener="#{dtstep2_tab1.UpdateStatus}" update="panel1" />
</p:selectBooleanCheckbox>
</p:column>
<p:column style="font-size:12px;width:70px;">
<f:facet name="header">
<h:outputText value="Employee Name"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_empname}" />
</p:column>
<p:column style="font-size:12px;width:120px;">
<f:facet name="header">
<h:outputText value="Contact Details"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_contactdet}" />
</p:column>
<p:column style="font-size:12px;width:70px;">
<f:facet name="header">
<h:outputText value="Worked Hrs to Date"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_totworkhours}" />
</p:column>
<p:column style="font-size:12px;width:50px;">
<f:facet name="header">
<h:outputText value="Agency Recruited"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_recruitmode}" />
</p:column>
<p:column style="font-size:12px;width:70px;">
<f:facet name="header">
<h:outputText value="Priority"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_priority}"/>
</p:column>
<p:column style="font-size:12px;width:90px;">
<f:facet name="header">
<h:outputText value="Type of Skill"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_skilltype}" />
</p:column>
<p:column style="font-size:12px;width:120px;">
<f:facet name="header">
<h:outputText value="Restriction"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_restriction}" />
</p:column>
<p:column style="font-size:12px;width:150px;">
<f:facet name="header">
<h:outputText value="Rest. Details"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_restdet}" />
</p:column>
<p:column style="font-size:12px;width:70px;">
<f:facet name="header">
<h:outputText value="B2B Days"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_b2bdays}" />
</p:column>
<p:column style="font-size:12px;width:70px;">
<f:facet name="header">
<h:outputText value="B2B Hrs"></h:outputText>
</f:facet>
<h:outputText value="#{step2table.rs2_b2bhrs}" />
</p:column>
<p:column headerText="Status" id="hStatus" style="font-size:12px;width:100px;">
<h:selectOneMenu id="cbo" value="#{step2table.rs2_status}" >
<f:selectItem itemLabel="Confirmed" itemValue="Confirmed"></f:selectItem>
<f:selectItem itemLabel="Selected" itemValue="Selected"></f:selectItem>
<f:selectItem itemLabel="Rejected" itemValue="Rejected"></f:selectItem>
</h:selectOneMenu>
</p:column>
<p:column style="font-size:12px;width:150px;">
<f:facet name="header">
<h:outputText value="Comments"></h:outputText>
</f:facet>
<h:inputText value="#{step2table.rs2_comments}" rendered="#{dtstep2_tab1.editable}"/>
</p:column>
Need to merge first three columns "date, Slot, and No of Resources Required" based on the employee column data. Guide me on this. Thanks in advance.
You can use p:summaryRow tag in p:dataTable. Example:
<h:form>
<p:dataTable var="car" value="#{dtSummaryRowView.cars}" sortBy="#{car.brand}">
<p:column headerText="Id" sortBy="#{car.id}">
<h:outputText value="#{car.id}" />
</p:column>
<p:column headerText="Year" sortBy="#{car.year}">
<h:outputText value="#{car.year}" />
</p:column>
<p:column headerText="Brand" sortBy="#{car.brand}">
<h:outputText value="#{car.brand}" />
</p:column>
<p:column headerText="Color" sortBy="#{car.color}">
<h:outputText value="#{car.color}" />
</p:column>
<p:summaryRow>
<p:column colspan="3" style="text-align:right">
<h:outputText value="Total:" />
</p:column>
<p:column>
<h:outputText value="#{dtSummaryRowView.randomPrice}">
<f:convertNumber type="currency" currencySymbol="$" />
</h:outputText>
</p:column>
</p:summaryRow>
</p:dataTable>
</h:form>
For more information, see the primefaces showcase link: http://www.primefaces.org/showcase/ui/data/datatable/summaryRow.xhtml
This is simply not possible in the datatable.
<p:column width="440">
<p:panelGrid rendered="#{someCondition}">
<f:facet name="header">
<p:row>
<p:column width="80"><h:outputText value="#{msg.isin}" /></p:column>
<p:column width="80"><h:outputText value="#{msg.wkn}" /></p:column>
<p:column width="200"><h:outputText value="#{msg.name}" /></p:column>
<p:column width="80"><h:outputText value="#{msg.amount}" /></p:column>
</p:row>
</f:facet>
<p:row>
<p:column><h:outputText value="#{savingsPlanPosition.isin}" /></p:column>
<p:column><h:outputText value="#{savingsPlanPosition.wkn}" /></p:column>
<p:column><h:outputText value="#{savingsPlanPosition.name}" /></p:column>
<p:column><h:outputText value="#{savingsPlanPosition.amount}" /></p:column>
</p:row>
</p:panelGrid>
<p:panelGrid rendered="#{!someCondition}">
<h:link id="savingsPlanPositionDetails${rowIndex}"
title="#{msg.assign_etf}"
outcome="portfolioPositionDetail">
<f:param name="portfolioId"
value="#{savingsPlanController.portfolioId}"></f:param>
<f:param name="portfolioPositionId"
value="#{savingsPlanPosition.portfolioPositionId}"></f:param>
<f:param name="from"
value="savingsPlan"></f:param>
<h:outputText value="#{msg.assign_etf}"/>
</h:link>
</p:panelGrid>
</p:column>
I have applied Global Filtering on a <p:dataTable> but that's not working at all. The getter is being called in the Bean but the <p:dataTable> is not being updated according to the search.
The code is:
<p:dialog id="searchStdentsDlg" header="Search Students" widgetVar="srchStdents" modal="true">
<h:form id="searchStdentsFrm">
<p:dataTable id="srchStdentsTble"
var="student"
value="#{viewStudentsBean.studentsList}"
widgetVar="srchStdentTbl"
emptyMessage="No students found with the given criteria"
filteredValue="#{viewStudentsBean.filteredStudents}">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search Students:" />
<p:inputText id="globalFilterStdents" onkeyup="PF('srchStdentTbl').filter()" style="width:200px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column id="stdentId" headerText="Id" filterBy="#{student.id}" filterStyle="display:none">
<h:outputText value="#{student.id}" />
</p:column>
<p:column id="stdentFirstName" headerText="Firstname" filterBy="#{student.firstName}" filterStyle="display:none">
<h:outputText value="#{student.firstName}" />
</p:column>
<p:column id="stdentLastname" headerText="Lastname" filterBy="#{student.lastName}" filterStyle="display:none">
<h:outputText value="#{student.lastName}" />
</p:column>
<p:column id="stdentFathername" headerText="Father name" filterBy="#{student.fatherName}" filterStyle="display:none">
<h:outputText value="#{student.fatherName}" />
</p:column>
<p:column id="stdentGender" headerText="Gender" filterBy="#{student.gender}" filterStyle="display:none">
<h:outputText value="#{student.gender}" />
</p:column>
<p:column id="stdentDOB" headerText="Date Of birth" filterBy="#{student.dob}" filterStyle="display:none">
<h:outputText value="#{student.dob}" />
</p:column>
<p:column id="stdentSkype" headerText="Skype/Email" filterBy="#{student.skypeOrEmailId}" filterStyle="display:none">
<h:outputText value="#{student.skypeOrEmailId}" />
</p:column>
<p:column id="stdentPhone" headerText="Phone No" filterBy="#{student.phoneNumber}" filterStyle="display:none">
<h:outputText value="#{student.phoneNumber}" />
</p:column>
<p:column id="stdentAddrs" headerText="Address" filterBy="#{student.address}" filterStyle="display:none">
<h:outputText value="#{student.address}" />
</p:column>
<p:column id="stdentCountry" headerText="Country" filterBy="#{student.country}" filterStyle="display:none">
<h:outputText value="#{student.country}" />
</p:column>
<p:column id="stdentJOD" headerText="Joining Date" filterBy="#{student.dateOfJoining}" filterStyle="display:none">
<h:outputText value="#{student.dateOfJoining}" />
</p:column>
<p:column id="stdentGenralRmrks" headerText="General Remarks" filterBy="#{student.generalRemarks}" filterStyle="display:none">
<h:outputText value="#{student.generalRemarks}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
I have another datatable in which Global Filtering is working absolutely fine.
That code is:
<p:dialog id="searchTchrsDlg" header="Search Teachers" widgetVar="srchTchrs" modal="true">
<h:form id="searchTchrsFrm">
<p:dataTable id="srchTechrsTble"
var="teacher"
value="#{viewTeachersBean.teachersList}"
widgetVar="srchTchrsTbl"
emptyMessage="No Teachers found with the given criteria"
filteredValue="#{viewTeachersBean.filteredTeachers}">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search Teachers:" />
<p:inputText id="globalFilter" onkeyup="PF('srchTchrsTbl').filter()" style="width:200px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column headerText="Id" filterBy="#{teacher.id}" filterStyle="display:none">
<h:outputText value="#{teacher.id}" />
</p:column>
<p:column headerText="Firstname" filterBy="#{teacher.firstName}" filterStyle="display:none">
<h:outputText value="#{teacher.firstName}" />
</p:column>
<p:column headerText="Lastname" filterBy="#{teacher.lastName}" filterStyle="display:none">
<h:outputText value="#{teacher.lastName}" />
</p:column>
<p:column headerText="Contact No" filterBy="#{teacher.contactNo}" filterStyle="display:none">
<h:outputText value="#{teacher.contactNo}" />
</p:column>
<p:column headerText="Address" filterBy="#{teacher.address}" filterStyle="display:none">
<h:outputText value="#{teacher.address}" />
</p:column>
<p:column headerText="Joining Date" filterBy="#{teacher.joiningDate}" filterStyle="display:none">
<h:outputText value="#{teacher.joiningDate}" />
</p:column>
<p:column headerText="Qualification" filterBy="#{teacher.qualification}" filterStyle="display:none">
<h:outputText value="#{teacher.qualification}" />
</p:column>
<p:column headerText="Subjects" filterBy="#{teacher.subjects}" filterStyle="display:none">
<h:outputText value="#{teacher.subjects}" />
</p:column>
<p:column headerText="Languages" filterBy="#{teacher.languagesProficiency}" filterStyle="display:none">
<h:outputText value="#{teacher.languagesProficiency}" />
</p:column>
<p:column headerText="Total Exp" filterBy="#{teacher.totalExperience}" filterStyle="display:none">
<h:outputText value="#{teacher.totalExperience}" />
</p:column>
<p:column headerText="Salary" filterBy="#{teacher.salary}" filterStyle="display:none">
<h:outputText value="#{teacher.salary}" />
</p:column>
<p:column headerText="Total Leaves" filterBy="#{teacher.totalLeavesLimit}" filterStyle="display:none">
<h:outputText value="#{teacher.totalLeavesLimit}" />
</p:column>
</p:dataTable>
</h:form>
</p:dialog>
I am using PrimeFaces 5.0 and JSF 2.2
PS: There are no exceptions on server side and no errors in browser console.
I would greatly appreciate any help. Thank you.
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>