ADF 얼굴이 새로운데 af : selectOneChoice의 값 변경에 partialTrigger a : panelAccordion 문제가 있습니다. af : panelAccordion에는 af : showDetailItem 내에 여러 개의 af : showDetailHeader가 있습니다. 모든 af : showDetailItem 및 af : showDetailHeader가 동적으로 생성됩니다. 빈 대학 뷰 범위에 그 코드는 아래와 같습니다 : 부서 및 직원 클래스는 간단한 POJO이다af : panelAccordion partialtrigger on af : selectOneChoice valueChangeListener
public class College {
private List<Department> departments;
private List<SelectItem> departmentDropDownMenu;
private String selectedDepartment;
public College() {
this.departments = new ArrayList<Department>(0);
Employee employee1 = new Employee("Employee 1", "Information");
Employee employee2 = new Employee("Employee 2", "Information");
Employee employee3 = new Employee("Employee 3", "Information");
Employee employee4 = new Employee("Employee 4", "Information");
Employee employee5 = new Employee("Employee 5", "Information");
List<Employee> employees1 = new ArrayList<Employee>(0);
employees1.add(employee1);
List<Employee> employees2 = new ArrayList<Employee>(0);
employees2.add(employee2);
List<Employee> employees3 = new ArrayList<Employee>(0);
employees3.add(employee3);
List<Employee> employees4 = new ArrayList<Employee>(0);
employees4.add(employee4);
employees4.add(employee5);
Department department1 = new Department("Department 1", employees1);
Department department2 = new Department("Department 2", employees2);
Department department3 = new Department("Department 3", employees3);
Department department4 = new Department("Department 4", employees4);
this.departments.add(department1);
this.departments.add(department2);
this.departments.add(department3);
this.departments.add(department4);
List<SelectItem> departmentDropDownMenu = new ArrayList<SelectItem>(0);
departmentDropDownMenu.add(new SelectItem("Department 1"));
departmentDropDownMenu.add(new SelectItem("Department 2"));
departmentDropDownMenu.add(new SelectItem("Department 3"));
departmentDropDownMenu.add(new SelectItem("Department 4"));
this.setDepartmentDropDownMenu(departmentDropDownMenu);
this.setSelectedDepartment("Department 1");
}
public void departmentDropDrownValueChangeListener(ValueChangeEvent event) {
String oldValue = event.getOldValue().toString();
String newValue = event.getNewValue().toString();
if(oldValue.equalsIgnoreCase(newValue)) {
return;
}
List<Department> departmentUpdated = new ArrayList<Department>(0);
for (Department department : departments) {
if(department.getDepartmentName().equals(newValue)) {
departmentUpdated.add(department);
break;
}
}
for (Department department : departments) {
if(!department.getDepartmentName().equals(newValue)) {
departmentUpdated.add(department);
}
}
this.setDepartments(departmentUpdated);
}
public void setDepartments(List<Department> departments) {
this.departments = departments;
}
public List<Department> getDepartments() {
return departments;
}
public void setDepartmentDropDownMenu(List<SelectItem> departmentDropDownMenu) {
this.departmentDropDownMenu = departmentDropDownMenu;
}
public List<SelectItem> getDepartmentDropDownMenu() {
return departmentDropDownMenu;
}
public void setSelectedDepartment(String selectedDepartment) {
this.selectedDepartment = selectedDepartment;
}
public String getSelectedDepartment() {
return selectedDepartment;
}
}
. Department 클래스는 두 개의 필드, 즉 을 포함합니다. 1. departmentName 문자열과 2. 직원 클래스 도 해당 접근 자로 나열하고 Employee 클래스는 의 두 필드를 포함합니다. 1. 문자열 이름 및 2. 문자열 정보. selectOneChoice 다음 AF의 선택된 값에 따라 showDetailItem : 내가하고 싶은 것은 AF를 다시 정렬하는 것입니다
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document title="Page.jspx" id="d1">
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout id="pgl2">
<af:selectOneChoice label="Department" value="#{college.selectedDepartment}" id="soc1"
unselectedLabel="" autoSubmit="true" immediate="true"
valueChangeListener="#{college.departmentDropDrownValueChangeListener}">
<f:selectItems value="#{college.departmentDropDownMenu}" id="si1"/>
</af:selectOneChoice>
<af:panelAccordion id="pa1" discloseNone="true" partialTriggers="soc1" discloseMany="true">
<af:forEach items="#{college.departments}" var="department">
<af:showDetailItem text="#{department.departmentName}" id="sdi1">
<af:forEach items="#{department.employees}" var="employee">
<af:showDetailHeader text="#{employee.name}" disclosed="false" id="sdh1">
<af:outputText value="#{employee.info}" id="ot1"/>
</af:showDetailHeader>
</af:forEach>
</af:showDetailItem>
</af:forEach>
</af:panelAccordion>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>
:
페이지의하여 jspx 코드
은 아래와 같습니다.나는 이미지에 문제를 보여주는 오전 :
첫 번째 이미지는 페이지로드 후 정상 상태입니다 볼 수 있듯이. 부서 1에는 직원이 1 명뿐입니다. 직원 1과 부서 4에는 직원 1, 직원 2의 직원 2 명이 있습니다. 드롭 다운에서 부서 4를 선택한 후 부서 3은 마지막 위치에 있지만 부서 3 패널에는 분명히 두 개의 af : showDetailItem이 있습니다 원래는 한 명의 직원 만 있습니다. 또한 해당 추가 af : showDetailItem 클릭 할 수 없습니다.
아무도 나에게 매우 도움이 될 제안을 해주십시오.
감사합니다.