-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdataTable.xhtml
46 lines (42 loc) · 1.69 KB
/
dataTable.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui" xmlns:f="http://xmlns.jcp.org/jsf/core"
xml:lang="en" lang="en">
<head>
<title>Title</title>
</head>
<body>
<cc:interface>
<cc:attribute name="title"/>
<cc:attribute name="dataView" type="ro.uaic.info.javatechnologies.optcourses.beans.DataView"/>
</cc:interface>
<cc:implementation>
<h:form id="form">
<p:growl id="msgs" showDetail="true"/>
<p:dataTable id="dataTable"
value="#{cc.attrs.dataView.entities}"
var="entity"
editable="true"
editMode="cell"
widgetVar="cellEntity"
rowKey="#{entity.id}">
<p:ajax event="cellEdit" listener="#{cc.attrs.dataView.onCellEdit}" />
<p:column headerText="Id">
<h:outputText value="#{entity.id}" />
</p:column>
<cc:insertFacet name="header"/>
<cc:insertChildren/>
<f:facet name="footer">
<p:commandButton id="addBtn" update="dataTable" action="#{cc.attrs.dataView.save}" value="Save"/>
</f:facet>
</p:dataTable>
<p:contextMenu for="dataTable" rowIndexVar="row" widgetVar="cMenu">
<p:menuitem value="Edit Cell" icon="ui-icon-search" onclick="PF('cellEntity').showCellEditor();return false;"/>
<p:menuitem value="Hide Menu" icon="ui-icon-close" onclick="PF('cMenu').hide()"/>
</p:contextMenu>
</h:form>
</cc:implementation>
</body>
</html>