I have a problem in datatable when adding a new line:
I want to add a blank line, but if I click on the button it adds a line but component remains.
<p:selectCheckboxMenu> contains old value.
That is to say value of <p:selectCheckboxMenu> preserves the value of the previous line
<p:dataTable value="#{solotionManager.customers}"
id="table" var="o"
widgetVar="50"
style="width: 100%;"
editable="true"
scrollHeight="330"
styleClass="datatable">
<p:ajax event="rowEdit" listener="#{customerBeansController2.onEdit}" update=":form1:table" process="#this"/>
<f:facet name="header">
Order List
</f:facet>
<p:ajax event="rowEditCancel" listener="#{customerBeansController2.onCancel}" update=":form1:messages"/>
<p:column>
<f:facet name="header" >
<h:outputText value="ID customer" style="width:100%"/>
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{o.id}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{o.id}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="firstName"/>
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{o.firstName}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{o.firstName}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="lastName"/>
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{o.lastName}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{o.lastName}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="SelectManyMenu" style="width:100%"/>
</f:facet>
<p:cellEditor>
<f:facet name="input">
<p:selectCheckboxMenu value="#{solotionManager.choice}" label="Phone" converter="entrantConverter">
<f:selectItems value="#{solotionManager.listeChoice}" var="c" itemValue="#{c}" itemLabel="#{c}"/>
</p:selectCheckboxMenu >
</f:facet>
<f:facet name="output">
<p:selectCheckboxMenu value="#{solotionManager.choice}" label="Phone" converter="entrantConverter">
<f:selectItems value="#{solotionManager.listeChoice}" var="c" itemValue="#{c}" itemLabel="#{c}"/>
</p:selectCheckboxMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options">
<p:rowEditor/>
</p:column>
</p:dataTable>
public String newLine(javax.faces.event.ActionEvent actionEvent) {
this.customers.add(this.custom1);
this.custom1=new Customer();
return null;
}
the code for the button that adds the line:
<p:commandButton value="add row" actionListener="#{solotionManager.newLine}" update="table" oncomplete="addRowOnComplete()"/>
Function javascript addRowOncomplete :
<script type="text/javascript">
function addRowOnComplete() {
jQuery('.ui-datatable-data tr td').last().find('span.ui-icon-pencil').each(function(){jQuery(this).click();});
}
</script>
Related
I have a requirement for an editable datatable that has a single column, lets say brand, that when set to "Other" will replace the editor in the next column, model - with an inputText rather than a selectOne. If any particular car brand is selected then the list of models for that brand is displayed. If "Other" is chosen then they can type in a model in an input text field. I can't seem to get the mechanics of this to work in primefaces using various combinations of rendered and events. Is this sort of inline switching of editing components based on the data in the row possible? I've built a simple example using the primefaces datatable demo for cars (and adding a field Model) to illustrate what I am attempting.
Page snippet
<p:dataTable id="cars1" var="car" value="#{dtEditView.cars1}"
editable="true" style="margin-bottom:20px">
<f:facet name="header">
Row Editing
</f:facet>
<p:ajax event="rowEdit" listener="#{dtEditView.onRowEdit}"
update="cars1" />
<p:ajax event="rowEditCancel" listener="#{dtEditView.onRowCancel}"
update="cars1" />
<p:column headerText="Id">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.id}" />
</f:facet>
<f:facet name="input">
<p:inputText id="modelInput" value="#{car.id}" style="width:100%" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Year">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.year}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{car.year}" style="width:100%" label="Year" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Brand">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.brand}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.brand}" style="width:100%">
<f:selectItems value="#{dtEditView.brands}" var="man"
itemLabel="#{man}" itemValue="#{man}" />
<p:ajax event="change" immediate="true" update="model model_ti"></p:ajax>
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Model">
<p:cellEditor rendered="#{car.brand != 'Other'}">
<f:facet name="output">
<h:outputText value="#{car.model}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{car.model}" style="width:100%"
id="model">
<f:selectItems value="#{dtEditView.getModels(car.brand)}"
var="man" itemLabel="#{man}" itemValue="#{man}" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
<p:cellEditor rendered="#{car.brand == 'Other'}">
<f:facet name="output">
<h:outputText value="#{car.model}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{car.model}" style="width:100%"
id="model_ti" />
</f:facet>
</p:cellEditor>
</p:column>
Thanks!
I was able to solve this problem by putting an ID on the cell editor for model, and adding that to the update list when changing brand.
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>
So I am trying to use a PrimeFaces data table to set data to a list as follows;
<h:form id="frmSalarySupplement">
<p:panel>
<p:dataTable id="tblSalarySupplement"
value="#{salSupplementMB.dataListFromDB}"
var="salSupp"
rowIndexVar="rowSn"
scrollable="true"
rows="10"
paginator="true"
editable="true"
editMode="cell"
rowsPerPageTemplate="10,20,50,100">
<p:ajax event="cellEdit"
listener="#{salSupplementMB.onCellEdit}"
update="#this" />
<p:column headerText="#" escape="false"
style="white-space:pre-line;
word-break:break-all;
width:20px;
text-align:center;">
<h:outputText value="#{rowSn+1}" />
</p:column>
<p:column headerText="Name"
style="white-space:pre-line;
word-break:break-all;
width:250px;">
<h:outputText value="#{salSupp.empId.name}" />
</p:column>
<p:column headerText="Designation"
style="white-space:pre-line;
word-break:break-all;
width:150px;">
<h:outputText value="#{salSupp.empId.designation.designationName}" />
</p:column>
<p:column headerText="Allowance"
style="white-space:pre-line;
word-break:break-all;
width:100px;">
<p:cellEditor>
<f:facet name="input">
<h:inputText value="#{salSupp.allowance}"
style="width:100%" />
</f:facet>
<f:facet name="output">
<h:outputText value="#{salSupp.allowance}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Special
Allowance"
style="white-space:pre-line;
word-break:break-all;
width:100px;">
<p:cellEditor>
<f:facet name="input">
<h:inputText value="#{salSupp.specialAllowance}"
style="width:100%" />
</f:facet>
<f:facet name="output">
<h:outputText value="#{salSupp.specialAllowance}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Transport
Allowance"
style="white-space:pre-line;
word-break:break-all;
width:100px;">
<p:cellEditor>
<f:facet name="input">
<h:inputText value="#{salSupp.transportAllowance}"
style="width:100%" />
</f:facet>
<f:facet name="output">
<h:outputText value="#{salSupp.transportAllowance}" />
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</p:panel>
</h:form>
So I want to be able to save the data I have edited on the cell to set it on the list. When I do the following, I don't get an updated value.
public void onCellEdit(CellEditEvent event) {
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
}
Can someone suggest what shall I do with it?
Update
Also, can anyone tell me why my table loads multiple times when I edit the value? Maybe that's what's giving me the problem.
I have a datatable element where I use a rowEditor. Additionally it is possible to add a new record which is implemented as inputFields in the footer of the table. All elements are validated. The problem is, that when a user hits the rowEditor the validation complains that the values for a new record are not set.
How can I avoid that the new record fields are being validated when the rowEditor is clicked?
I fiddled around a bit with proccess & immediate on the ajax events but I'm not able to figure this out. Is this possible and if yes, how? I'm thankful for help.
<p:dataTable var="contact"
value="#{data.activeCustomer.contacts.toArray()}"
id="contactsTable"
emptyMessage="#{ivy.cms.co('/Translations/Administration/noRecordsFoundSearch')}"
editable="true">
<p:ajax event="rowEdit" listener="#{logic.onEdit(contact)}" />
<p:ajax event="rowEditCancel" listener="#{logic.onCancel}" />
<f:facet name="header">
#{ivy.cms.co('/Translations/Administration/Contacts/labelContacts')}
</f:facet>
<p:column
headerText="#{ivy.cms.co('/Translations/Administration/Contacts/prename')}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{contact.prename}" />
</f:facet>
<f:facet name="input">
<p:inputText required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterPrename')}"
value="#{contact.prename}"></p:inputText>
</f:facet>
</p:cellEditor>
<f:facet name="footer">
<p:inputText required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterPrename')}"
value="#{data.contactPrename}" />
</f:facet>
</p:column>
<p:column
headerText="#{ivy.cms.co('/Translations/Administration/Contacts/surname')}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{contact.surname}" />
</f:facet>
<f:facet name="input">
<p:inputText required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterSurname')}"
value="#{contact.surname}"></p:inputText>
</f:facet>
</p:cellEditor>
<f:facet name="footer">
<p:inputText required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterSurname')}"
value="#{data.contactSurname}" />
</f:facet>
</p:column>
<p:column
headerText="#{ivy.cms.co('/Translations/Administration/Contacts/phone')}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{contact.phone}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{contact.phone}"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterPhone')}"
required="true"></p:inputText>
</f:facet>
</p:cellEditor>
<f:facet name="footer">
<p:inputText
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterPhone')}"
required="true" value="#{data.contactPhone}" />
</f:facet>
</p:column>
<p:column
headerText="#{ivy.cms.co('/Translations/Administration/Contacts/email')}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{contact.email}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{contact.email}" required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterEmail')}">
<f:validator validatorId="EmailValidator" />
</p:inputText>
</f:facet>
</p:cellEditor>
<f:facet name="footer">
<p:inputText required="true"
requiredMessage="#{ivy.cms.co('/Translations/CustomerAdministration/Validation/enterEmail')}"
value="#{data.contactEmail}">
<f:validator validatorId="EmailValidator" />
</p:inputText>
</f:facet>
</p:column>
<p:column style="width: 6%"
headerText="#{ivy.cms.co('/Translations/CustomerAdministration/actionsColumnTitle')}">
<p:rowEditor />
<p:commandLink styleClass="ui-icon ui-icon-trash"
actionListener="#{logic.deleteContact(contact)}"
icon="ui-icon-trash" update=":#{p:component('contactForm')}"
immediate="true" />
<f:facet name="footer">
<h:commandButton
value="#{ivy.cms.co('/Translations/Administration/Contacts/ButtonAddContact')}"
actionListener="#{logic.addContact}" />
</f:facet>
</p:column>
</p:dataTable>
</h:form>
#Named(value = "viewtable")
#ManagedBean
#ViewScoped
public final class viewtable implements Serializable {
ArrayList<viewbean> dlist = new ArrayList<viewbean>();
ArrayList<Master> mlist = new ArrayList<Master>();
public ArrayList<viewbean> getDlist() {
return dlist;
}
public viewtable() {
get();
}
public void get() {
try
{
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/mydsn");
Connection con = ds.getConnection();
PreparedStatement ps=con.prepareStatement("select * from master");
ResultSet rs=ps.executeQuery();
while(rs.next())
{
dlist.add(new viewbean(rs.getString(1), rs.getString(2),rs.getString(3),rs.getString(4),rs.getDate(5), rs.getString(6), rs.getBytes(7), rs.getString(8),rs.getString(9),rs.getString(10),rs.getString(11),rs.getDate(12),rs.getDate(13),rs.getString(14),rs.getString(15), rs.getString(16)));
}
}catch(Exception ex)
{
System.out.println("Conncetion pool db error-> "+ex);
}
}
public void onEdit(RowEditEvent event) {
}
}
The above code didn't update the data in the database in the get() method I've done any error and how to connect with the database using PrimeFaces.
I used a managed bean for save details from the database as a list called mlist.
JSF:
<h:form id="dtform">
<p:growl showDetail="true" id="mess"/>
<p:dataTable id="dt1" scrollable="true" scrollWidth="700" var="mas" value="#{viewtable.dlist}" editable="true">
<f:facet name="header">
Edit Here
</f:facet>
<p:column headerText="Regno" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.regno}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.regno}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Rollno" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.rollno}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.rollno}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Firstname" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.fname}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.fname}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Lastname" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.lname}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.lname}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="D.O.B" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.dob}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.dob}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.address}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.address}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Avatar" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.avatar}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.avatar}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Email" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.email}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.email}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Phno" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.phno}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.phno}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Dept" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.dept}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.dept}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Year" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.year}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.year}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Start" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.inidate}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.inidate}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="End" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.enddate}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.enddate}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Remarks" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.remarks}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.remarks}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Delivery" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.delivery}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.delivery}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Message" width="100">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{mas.messdelivery}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{mas.messdelivery}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options" width="100">
<p:rowEditor/>
</p:column>
<p:ajax event="rowEdit" listener="#{viewtable.onEdit}" update=":dtform:mess"/>
</p:dataTable>
</h:form>
I assume you have configured hibernate in your environment, and mapped your database to an entity class. you can update the records accordingly.
You can access the rows and update the records like :
public void onEdit(RowEditEvent event) {
YourHibernateEntity yourEntity = (YourHibernateEntity ) event.getObject());
SessionFactory sessFact = new AnnotationConfiguration().configure().buildSessionFactory();
Session sess = sessFact.openSession();
Transaction tran = sess.beginTransaction();
sess.update(yourEntity );
tran.commit();
}