Primefaces DataTable in Second tab not displaying data - jsf

I have a primefaces page containing 2 tabs. Both tabs has its own data Table. When finish querying data, dataTable in the first tab displays queried data fine but the second tab does not (please refer to the picture.)
here is my xhtml file code
<code>
<h:body>`enter code here`
<h:form id="myForm">
<p:menubar>
<p:menuitem value="Logout" icon="ui-icon-close" ajax="false" immediate="true" action="#{logoutManagedBean.logout}" />
</p:menubar>
<p:growl id="growlExtractTimesheet" sticky="false" showDetail="true" life="3000" />
<h:panelGrid style="margin-top:20px; border:none; border-style: none; border-width: 0px;" columns="7" >
<p:outputLabel for="fromDateCalendar" value=' From ' />
<p:calendar id='fromDateCalendar'
value="#{dataProcessingManagedBean.fromDate}"
binding="#{dataProcessingManagedBean.fromDateCalendar}"
pattern="dd-MMM-yyyy"
required="true"
requiredMessage="From Date Required"
valueChangeListener="#{dataProcessingManagedBean.determineExtractButtonDisability}" >
<p:ajax event="dateSelect" partialSubmit="fromDateCalendar" update="extractTimesheetButton" />
</p:calendar>
<p:outputLabel for="toDateCalendar" value='To ' />
<p:calendar id='toDateCalendar'
value="#{dataProcessingManagedBean.toDate}"
binding="#{dataProcessingManagedBean.toDateCalendar}"
pattern="dd-MMM-yyyy"
required="true"
requiredMessage="To Date Required"
valueChangeListener="#{dataProcessingManagedBean.determineExtractButtonDisability}" >
<p:ajax event="dateSelect" partialSubmit="toDateCalendar" update="extractTimesheetButton" />
</p:calendar>
<p:commandButton id='extractTimesheetButton'
actionListener ="#{dataProcessingManagedBean.extractTimesheetData}"
binding ="#{dataProcessingManagedBean.extractTimesheetCommandButton}"
update='myForm:tabview:detailDataTable myForm:tabview:summaryDataTable myForm:downloadExcelsButton'
ajax="true" icon="ui-icon-calculator" >
</p:commandButton>
<p:commandButton id="downloadExcelsButton" ajax="false" actionListener="#{dataProcessingManagedBean.downloadExcelFile}"
binding="#{dataProcessingManagedBean.downloadExcelsCommandButton}" icon="ui-icon-arrowthick-1-s" disabled="true"/>
</h:panelGrid>
<p:tabView id='tabview' cache="false">
<p:tab title="Detail Data" id='detailTab'>
<p:dataTable id='detailDataTable' var="detailData" paginatorPosition="top"
value="#{dataProcessingManagedBean.detailDatas}" paginator="true"
rows="100" rowsPerPageTemplate="100,200,500,1000, 2000, 5000, 10000, 20000, 50000" lazy='true'
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginatorTemplate="{CurrentPageReport} {RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "
scrollable="true" scrollHeight="350"
liveResize="true" draggableColumns="true" resizableColumns="true"
selectionMode="multiple" selection="#{dataProcessingManagedBean.selectedDetailDatas}" rowKey="#{detailData.id}" >
<p:column headerText="Employee ID" width="80">
<h:outputText value="#{detailData.employeeId}" />
</p:column>
<p:column headerText="Employee Name Lastname" width="200">
<h:outputText value="#{detailData.employeeName}" />
</p:column>
<p:column headerText="Cost Center" width="100">
<h:outputText value="#{detailData.costCenter}" />
</p:column>
<p:column headerText="WBS Code" width="100">
<h:outputText value="#{detailData.wbsCode}" />
</p:column>
<p:column headerText="WBS Name" width="300">
<h:outputText value="#{detailData.wbsName}" />
</p:column>
<p:column headerText="Project Code" width="100">
<h:outputText value="#{detailData.projectCode}" />
</p:column>
<p:column headerText="Project Name" width="300">
<h:outputText value="#{detailData.projectName}" />
</p:column>
<p:column headerText="Activity" width="300">
<h:outputText value="#{detailData.activity}" />
</p:column>
<p:column headerText="Task" width="300">
<h:outputText value="#{detailData.task}" />
</p:column>
<p:column headerText="Role" width="150">
<h:outputText value="#{detailData.role}" />
</p:column>
<p:column headerText="Timesheet Date" width="100">
<h:outputText value="#{detailData.timesheetDate}" />
</p:column>
<p:column headerText="Total Working Hours" width="150">
<h:outputText value="#{detailData.totalWorkingHours}" />
</p:column>
<p:column headerText="Utilized" width="50">
<h:outputText value="#{detailData.utilized}" />
</p:column>
<p:column headerText="Billable" width="50">
<h:outputText value="#{detailData.billable}" />
</p:column>
<p:column headerText="OT" width="50">
<h:outputText value="#{detailData.ot}" />
</p:column>
<p:column headerText="On Time" width="80">
<h:outputText value="#{detailData.onTime}" />
</p:column>
<p:column headerText="Status" width="80">
<h:outputText value="#{detailData.status}" />
</p:column>
<p:column headerText="Remark" width="500">
<h:outputText value="#{detailData.remark}" />
</p:column>
</p:dataTable>
</p:tab>
<p:tab title="Summary Data" id='summaryTab'>
<p:dataTable id='summaryDataTable' var="summaryData" paginatorPosition="top"
value="#{dataProcessingManagedBean.summaryDatas}" paginator="true"
rows="50" rowsPerPageTemplate="50, 100, 200" lazy='true'
currentPageReportTemplate="Showing {startRecord}-{endRecord} out of {totalRecords}"
paginatorTemplate="{CurrentPageReport} {RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} "
scrollable="true" scrollHeight="350"
liveResize="true" draggableColumns="true" resizableColumns="true"
selectionMode="multiple" selection="#{dataProcessingManagedBean.selectedSummaryDatas}" rowKey="#{summaryData.id}" >
<p:column headerText="Employee ID" width="80">
<h:outputText value="#{summaryData.employeeId}" />
</p:column>
<p:column headerText="Employee Name Lastname" width="200">
<h:outputText value="#{summaryData.employeeName}" />
</p:column>
<p:column headerText="Normal Billable hour(s)" width="100">
<h:outputText value="#{summaryData.normalBillableHours}" />
</p:column>
<p:column headerText="Normal Non-Billable hour(s)" width="100">
<h:outputText value="#{summaryData.normalNonBillableHours}" />
</p:column>
<p:column headerText="Total Normal hours(s)" width="100">
<h:outputText value="#{summaryData.totalNormalHours}" />
</p:column>
<p:column headerText="OT Billable hour(s)" width="100">
<h:outputText value="#{summaryData.otBillableHours}" />
</p:column>
<p:column headerText="OT Non-Billable hour(s)" width="100">
<h:outputText value="#{summaryData.otNonBillableHours}" />
</p:column>
<p:column headerText="Total OT hour(s)" width="100">
<h:outputText value="#{summaryData.totalOTHours}" />
</p:column>
<p:column headerText="Total hour(s)" width="100">
<h:outputText value="#{summaryData.totalHours}" />
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
<p:ajaxStatus onstart="PF('statusDialog').show()" onsuccess="PF('statusDialog').hide()" onerror="PF('statusDialog').hide()"/>
<p:dialog id="waitDialog" widgetVar="statusDialog" modal="true" draggable="false" closable="false" resizable="false" showHeader="false">
<p:graphicImage value="/images/ajax_wait.gif" />
</p:dialog>
</h:form>
</h:body>
</html>
and this is the result.
if anyone has come across this problem and solved it. please help Thank you.

I think I have solved the problem by putting attribute dynamic='true' for tabView component.

Related

Is there a way to replace the headerText by the first value of my dataTable in Primefaces?

I want my table headers to have the first value of my dataTable.
I know I can change the value of the headerText but for my project I need the header to change according to the values being output.
So from the picture I want 'col1' to be replace by 'jour', 'col2' by 'lundi', 'col3' by 'mardi', etc
<p:dataTable resizableColumns="true" liveResize="true" stripedRows="true" size="large" id="a" var="test"
value="#{testMB1.testlist}" style="padding:20px;" rows="15" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{startRecord}-{endRecord} of {totalRecords} records"
rowsPerPageTemplate="3,5,10,15,25, 50, 100, 250, 500" rowKey="#{test.id}" scrollable="true" update="mainForm:a"
frozenRows="1">
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search all fields:" />
<p:inputText filterBy="#{test.id}" id="globalFilter" onkeyup="PF('test').filter()" placeholder="Enter keyword"
filterMatchMode="contains" style="width:200px;height:25px;align:right;" />
</p:outputPanel>
</f:facet>
<p:column headerText="Id" sortBy="#{test.id}">
<h:outputText value="#{test.id}" />
</p:column>
<p:column headerText="col1" sortBy="#{test.col1}" filterMatchMode="contains" filterBy="#{test.col1}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col1}" />
</p:column>
<p:column headerText="col2" sortBy="#{test.col2}" filterMatchMode="contains" filterBy="#{test.col2}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col2}" />
</p:column>
<p:column headerText="col3" sortBy="#{test.col3}" filterMatchMode="contains" filterBy="#{test.col3}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col3}" />
</p:column>
<p:column headerText="col4" sortBy="#{test.col4}" filterMatchMode="contains" filterBy="#{test.col4}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col4}" />
</p:column>
<p:column headerText="col5" sortBy="#{test.col5}" filterMatchMode="contains" filterBy="#{test.col5}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col5}" />
</p:column>
<p:column headerText="col6" sortBy="#{test.col6}" filterMatchMode="contains" filterBy="#{test.col6}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col6}" />
</p:column>
<p:column headerText="col7" sortBy="#{test.col7}" filterMatchMode="contains" filterBy="#{test.col7}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col7}" />
</p:column>
<p:column headerText="col8" sortBy="#{test.col8}" filterMatchMode="contains" filterBy="#{test.col8}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col8}" />
</p:column>
<p:column headerText="col9" sortBy="#{test.col9}" filterMatchMode="contains" filterBy="#{test.col9}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col9}" />
</p:column>
<p:column headerText="col10" sortBy="#{test.col10}" filterMatchMode="contains" filterBy="#{test.col10}"
onkeyup="PF('test').filter()">
<h:outputText value="#{test.col10}" />
</p:column>
</p:dataTable>
My dataTable
Replace all headerText with the code below (according to your mapping object). In the bean, don't forget to verify your list against null, in order not to get a NullPointerException.
<p:column headerText="#{testMB1.testlist.get(0).id}">
Technically speaking a better approach will be to create in the bean a final list, with the columns headers, and call it in the headerText.
If the headers are dynamic, you can use dynamic columns, as suggested by Jasper de Vries

How to update one single row in p:dataTable

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>

javax.faces.FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled or define rowKey attribute

I saw this problem here many times but it doesn't help me.
I have the first dataTable with id:servers and I can do right click over a row and a contextMenu appears. I can click in Show Process and I get a second dataTable with id:processes.
But here is the problem, instead of showing the new dataTable I get,
javax.faces.FacesException: DataModel must implement
org.primefaces.model.SelectableDataModel when selection is enabled or
you need to define rowKey attribute
But I have defined rowKey in both dataTable
I have this code:
<h:form id="form" onkeypress="return event.keyCode != 13">
<!-- <p:messages id="msgs" /> -->
<p:growl id="msgs" showDetail="true" sticky="true" autoUpdate="true" />
<!-- Context menu for servers table. -->
<p:contextMenu for="servers">
<p:menuitem value="Show processes" update="form" icon="ui-icon-search" actionListener="#{homeBean.findLSRunningProcesses}" styleClass="homeIE"/>
</p:contextMenu>
<!-- Context menu for processes table. -->
<p:contextMenu for="processes">
<p:menuitem styleClass="homeIE" update="#form" value="Stop Process" icon="ui-icon-stop" oncomplete="stopDialog.show()"/>
</p:contextMenu>
<!-- Servers table. -->
<p:dataTable id="servers" var="server" value="#{homeBean.serverList}" paginator="true" rows="10"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" widgetVar="serversTable" rowKey="#{server.adminFQDN}"
selection="#{homeBean.selectedLogicalServer}" selectionMode="single" emptyMessage="No servers found with given criteria">
<f:facet name="header">
<h:outputText value="Servers" />
</f:facet>
<p:column filterBy="#{server.ASSETID}" filterMatchMode="contains" sortBy="#{server.ASSETID}" headerText="ASSETID">
<h:outputText value="#{server.ASSETID}" />
</p:column>
<p:column filterBy="#{server.adminFQDN}" filterStyle="width:240px;" filterMatchMode="contains" sortBy="#{server.adminFQDN}" headerText="FQDN">
<h:outputText value="#{server.adminFQDN}" />
</p:column>
<p:column filterBy="#{server.adminIP}" filterMatchMode="contains" sortBy="#{server.adminIP}" headerText="Admin IP">
<h:outputText value="#{server.adminIP}" />
</p:column>
<p:column filterBy="#{server.delivery}" filterMatchMode="exact" sortBy="#{server.delivery}" headerText="Delivery">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="false" />
<f:selectItems label="#{homeBean.deliveries}" value="#{homeBean.deliveries}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.delivery}" />
</p:column>
<p:column filterBy="#{server.environment}" filterMatchMode="exact" sortBy="#{server.environment}" headerText="Environment">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" noSelectionOption="true" itemValue="#{null}"/>
<f:selectItems value="#{homeBean.environments}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.environment}" />
</p:column>
<p:column filterBy="#{server.function}" filterMatchMode="exact" sortBy="#{server.function}" headerText="Function">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{homeBean.functions}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.function}" />
</p:column>
<p:column filterBy="#{server.osVersion}" filterMatchMode="contains" sortBy="#{server.osVersion}" headerText="OS VERSION">
<h:outputText value="#{server.osVersion}" />
</p:column>
<p:column filterBy="#{server.os}" filterMatchMode="contains" sortBy="#{server.os}" headerText="OS">
<h:outputText value="#{server.os}" />
</p:column>
</p:dataTable>
<!-- Panel containing processes tables. -->
<p:panelGrid id="serverProcesses" styleClass="group-user-selection-table" rendered="#{homeBean.showSelectionPanel}">
<f:facet name="header">
<p:row>
<p:column>
<h:outputText value="#{homeBean.selectedLogicalServer.adminFQDN}" />
</p:column>
</p:row>
</f:facet>
<p:row>
<!--Processes table. -->
<p:column>
<p:dataTable id="processes" var="process" value="#{homeBean.processesList}" filteredValue="#{homeBean.filteredProcesses}"
selection="#{homeBean.selectedProcesses}" paginator="true" rows="15" rowKey="#{process.owner}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="15,20,25,30" selectionMode="single" emptyMessage="No processses found with given criteria">
<f:facet name="header">
<h:outputText value="Processes" />
</f:facet>
<p:column name="owner" filterBy="#{process.owner}" filterMatchMode="contains" sortBy="#{process.owner}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'DESCRIPTION' : 'OWNER'}">
<h:outputText value="#{process.owner}" />
</p:column>
<p:column name="pid" filterBy="#{process.pid}" filterMatchMode="exact" sortBy="#{process.owner}" headerText="PID">
<h:outputText value="#{process.pid}" />
</p:column>
<p:column name="ppid" filterBy="#{process.ppid}" filterMatchMode="exact" sortBy="#{process.ppid}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'TYPE' : 'PPID'}">
<h:outputText value="#{process.ppid}" />
</p:column>
<p:column name="c" filterBy="#{process.c}" filterMatchMode="exact" sortBy="#{process.c}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'STATE' : 'C'}">
<h:outputText value="#{process.c}" />
</p:column>
<p:column name="stime" filterBy="#{process.stime}" filterMatchMode="contains" sortBy="#{process.stime}" headerText="STIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.stime}" />
</p:column>
<p:column name="tty" filterBy="#{process.tty}" filterMatchMode="contains" sortBy="#{process.tty}" headerText="TTY" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.tty}" />
</p:column>
<p:column name="time" filterBy="#{process.time}" filterMatchMode="contains" sortBy="#{process.time}" headerText="TIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.time}" />
</p:column>
<p:column name="cmd" filterBy="#{process.cmd}" filterMatchMode="contains" sortBy="#{process.cmd}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'NAME' : 'CMD'}">
<h:outputText value="#{process.cmd}" />
</p:column>
</p:dataTable>
</p:column>
</p:row>
</p:panelGrid>
<p:dialog header="Stop Process" widgetVar="stopDialog" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to stop the process "/>
<h:outputText value="#{homeBean.selectedProcesses.cmd}"/>
<h:outputText value="with PID"/>
<h:outputText value="#{homeBean.selectedProcesses.pid}"/>
<br /><br /><br /><br />
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" onclick="stopDialog2.show();stopDialog.hide();" actionListener="#{homeBean.attrListener}">
<f:attribute name="processPID" value="#{process.pid}" />
</p:commandButton>
<p:commandButton value="NO" onclick="stopDialog.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
<p:dialog header="Stop Process" widgetVar="stopDialog2" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to send an email to:"/>
<br />
<h:outputText value="#{homeBean.email}"/>
<br /><br /><br />
<p:commandLink value="Yes" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" update="form" action="#{homeBean.stopProcess}" oncomplete="stopDialog2.hide();"/>
<p:commandButton value="NO" onclick="stopDialog2.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
</h:form>
FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled
this solution works to me.
Especially this answer https://stackoverflow.com/a/10527008/5250930
The table must implement the SelectableDataModel

Headers are not shown in exported excel file from primefaces datatable

I have a datatable like this. But it would not export the headers to excel :
<h:form id="formOptionList">
<p:dataTable id="OptionTable"
var="Options"
widgetVar="OptionTable"
value="#{managedBean.options}"
filteredValue="#{managedBean.filteredOptions}"
emptyMessage="No Options found."
rendered="#{managedBean.userPreferences.showTable}"
paginator="true"
rows="10"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="20,50,100"
>
<p:column id="id" headerText="ID" filterBy="id" filterMatchMode="exact" width="12%" rendered="#{managedBean.userPreferences.showID}" >
<h:outputText value="#{options.optionID}" />
</p:column>
....
....
</p:dataTable>
<h:panelGrid columns="1">
<p:panel header="Export All Data">
<h:commandLink>
<p:graphicImage value="../resources/images/menuicons/options.png" />
<p:dataExporter type="xls" target="OptionTable" fileName="Options" />
</h:commandLink>
</p:panel>
</h:panelGrid>
</h:form>
So I changed it to
<p:column id="id" filterBy="id" filterMatchMode="exact" width="12%" rendered="#{managedBean.userPreferences.showID}" >
<f:facet name="header>">
<h:outputText value="Option ID"/>
</f:facet>
<h:outputText value="#{Options.OptionID}" />
</p:column>
And I still don't see the headers in the excel file. Any ideas ?
Headers are not shown in exported excel file from primefaces datatable
Try this:
<p:column id="id" filterBy="#{Options.OptionID}" filterMatchMode="exact" width="12%" rendered="#{managedBean.userPreferences.showID}" >
<f:facet name="header>">
<h:outputText value="Option ID"/>
</f:facet>
<h:outputText value="#{Options.OptionID}" />
</p:column>
You put a <h:outputText value= ""/> after your </f:facet> ?
<p:column>
<f:facet name="header">
<h:outputText value="Your Column Name" />
</f:facet>
<h:outputText value="Your value" />
</p:column>
You can put a new column with display none, from the existing column just put an exporter false
<p:column id="id" filterBy="# Options.OptionID}"filterMatchMode="exact" width="12%" rendered="#anagedBean.userPreferences.showID}"exporter="false">
<f:facet name="header>">
<h:outputText value="Option ID" />
</f:facet>
<h:outputText value="#{Options.OptionID}" />
</p:column>
Add new column with display none and remove all sorting,filtering and rendering
<p:column exporter="true" style="display:none;">
<f:facet name="header>">
<h:outputText value="Option ID"/>
</f:facet>
<h:outputText value="#{Options.OptionID}" />
</p:column>
This works perfectly.

primefaces dialog content is on page at the begining

Below is code of xhtml page,
even i put dialog in a form or not i can see outputtexts below of the page.
I am running into such situation for the first time.
<h:form id="form">
<h:outputLabel value="Welcome #{loginBean.name}"></h:outputLabel>
<p:dataTable id="cars" var="book" value="#{indexView.mediumBooksModel}" paginator="true" rows="10"
selection="#{indexView.selectedBook}" rowKey="">
<f:facet name="header">
RadioButton Based Selection
</f:facet>
<p:column selectionMode="single" style="width:2%" />
<p:column headerText="Title" style="width:25%">
#{book.title}
</p:column>
<p:column headerText="ISBN" style="width:25%">
#{book.isbn}
</p:column>
<p:column headerText="Year" style="width:24%">
#{book.year}
</p:column>
<p:column headerText="Price" style="width:24%">
#{book.price}
</p:column>
<f:facet name="footer">
<p:commandButton id="viewButton" value="View" icon="ui-icon-search"
update=":displaySingle" oncomplete="singleBookDialog.show()"/>
</f:facet>
</p:dataTable>
</h:form>
<p:dialog id="dialog" header="Book Detail" widgetVar="singleBookDialog" resizable="false"
modal="true" >
<h:panelGrid id="displaySingle" columns="2" cellpadding="4">
<f:facet name="header">
<p:graphicImage value="/images/books/#{indexView.selectedBook.image}.jpg"/>
</f:facet>
<h:outputText value="Title:" />
<h:outputText value="#{indexView.selectedBook.title}" style="font-weight:bold"/>
<h:outputText value="Year:" />
<h:outputText value="#{indexView.selectedBook.year}" style="font-weight:bold"/>
<h:outputText value="ISBN:" />
<h:outputText value="#{indexView.selectedBook.isbn}" style="font-weight:bold"/>
<h:outputText value="Price:" />
<h:outputText value="#{indexView.selectedBook.price}" style="font-weight:bold"/>
</h:panelGrid>
</p:dialog>

Resources