Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding sorting and filtering features.

  • Loading branch information...
commit 3a22765ff0da18cb3409f15d15fdf04879d25357 1 parent 0f61870
@rishabhsrao rishabhsrao authored
View
20 src/main/java/oss/process/scrum/managed/bean/OrganizationManagedBean.java
@@ -25,6 +25,8 @@
private OrganizationService organizationService;
private List<Organization> organizations;
+ private List<Organization> selectedOrganizations;
+ private List<Organization> filteredOrganizations;
/**
* @return the organizationService
@@ -81,7 +83,7 @@ public void updateOrganization(RowEditEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Organization editedOrganization = ((Organization) event.getObject());
-
+
try {
organizationService.update(editedOrganization);
context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Organization was updated successfully!", editedOrganization.toString()));
@@ -98,6 +100,22 @@ public void setOrganizations(List<Organization> organizations) {
this.organizations = organizations;
}
+ public List<Organization> getSelectedOrganizations() {
+ return selectedOrganizations;
+ }
+
+ public void setSelectedOrganizations(List<Organization> selectedOrganizations) {
+ this.selectedOrganizations = selectedOrganizations;
+ }
+
+ public List<Organization> getFilteredOrganizations() {
+ return filteredOrganizations;
+ }
+
+ public void setFilteredOrganizations(List<Organization> filteredOrganizations) {
+ this.filteredOrganizations = filteredOrganizations;
+ }
+
public void reset() {
organization.setAction(null);
organization.setCode(null);
View
29 src/main/webapp/app/administrator/module/manage-organizations.xhtml
@@ -6,8 +6,6 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
-
-
<h:form id="administrator-manage-organizations">
<p:toolbar>
<p:toolbarGroup align="left">
@@ -24,8 +22,21 @@
</p:toolbar>
- <p:dataTable id="organization-datatable" value="#{organizationManagedBean.organizations}" var="organization" editable="true">
- <p:column headerText="id">
+ <p:dataTable id="organization-datatable"
+ value="#{organizationManagedBean.organizations}"
+ var="organization"
+ editable="true"
+ widgetVar="organizationDatatable"
+ emptyMessage="No organizations found."
+ filteredValue="#{organizationManagedBean.filteredOrganizations}">
+
+ <f:facet name="header">
+ <p:outputPanel>
+ <p:inputText styleClass="pull-right" onkeyup="organizationDatatable.filter()" />
+ </p:outputPanel>
+ </f:facet>
+
+ <p:column headerText="id" sortBy="#{organization.id}" filterBy="#{organization.id}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.id}" />
@@ -36,7 +47,7 @@
</p:cellEditor>
</p:column>
- <p:column headerText="name">
+ <p:column headerText="name" sortBy="#{organization.name}" filterBy="#{organization.name}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.name}" />
@@ -47,7 +58,7 @@
</p:cellEditor>
</p:column>
- <p:column headerText="code">
+ <p:column headerText="code" sortBy="#{organization.code}" filterBy="#{organization.code}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.code}" />
@@ -58,7 +69,7 @@
</p:cellEditor>
</p:column>
- <p:column headerText="description">
+ <p:column headerText="description" sortBy="#{organization.description}" filterBy="#{organization.description}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.description}" />
@@ -69,7 +80,7 @@
</p:cellEditor>
</p:column>
- <p:column headerText="action">
+ <p:column headerText="action" sortBy="#{organization.action}" filterBy="#{organization.action}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.action}" />
@@ -80,7 +91,7 @@
</p:cellEditor>
</p:column>
- <p:column headerText="status">
+ <p:column headerText="status" sortBy="#{organization.status}" filterBy="#{organization.status}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{organization.status}" />
Please sign in to comment.
Something went wrong with that request. Please try again.