我有一个列显示作者姓名和一个命令链接“显示文档”。我想在单击detailStamp facet图标时单击Show Documents命令链接展开行。
这是JSFF代码:
<af:table var="row" rowBandingInterval="0" id="rohitT"
value="#{pageFlowScope.parseData.AList}" rowSelection="multiple"
binding="#{pageFlowScope.parseData.dataTable}"
disclosedRowKeys="#{pageFlowScope.parseData.disclosedKeys}">
<af:column sortable="false" headerText="Author" id="c3">
<af:outputText value="#{row.author}" id="ot5"/>
<af:commandLink text="Show Documents" id="sd"
actionListener="#{pageFlowScope.parseData.prepareLOV}" partialSubmit="true" >
</af:commandLink>
<af:outputText value="Disclosed Key::#{pageFlowScope.parseData.disclosedKeys}"
id="ot6"/>
</af:column>
<af:column sortable="false" headerText="Subject area" id="c2">
<af:outputText value="#{row.subjectArea}" id="ot4"/>
</af:column>
<af:column sortable="false" headerText="Select" id="c1">
<af:selectBooleanCheckbox id="sbc1" selected="false" autoSubmit="true"
disabled="#{pageFlowScope.optionSelected ne 'Default' and pageFlowScope.optionSelected ne 'One'}" valueChangeListener="#{pageFlowScope.parseData.onChange}"/>
<af:outputText value="PageFlow::#{pageFlowScope.optionSelected}"
id="ot3"/></af:column>
<f:facet name="detailStamp" >
<af:group id="g1">
<af:selectOneListbox label="Label 1" id="sol1"
value="#{pageFlowScope.parseData.selectedValues}">
<f:selectItems value="#{pageFlowScope.parseData.allValuesList}"
id="si2"/>
</af:selectOneListbox>
</af:group>
</f:facet>
</af:table>
以下是托管bean代码:
List selectedValues;
private RowKeySetImpl disclosedKeys=null;
List<SelectItem> allValuesList;
public void setDisclosedKeys(RowKeySetImpl disclosedKeys) {
this.disclosedKeys = disclosedKeys;
}
public void setAllValuesList(List<SelectItem> allValuesList) {
this.allValuesList = allValuesList;
}
public List<SelectItem> getAllValuesList() {
if (allValuesList == null) {
allValuesList = new ArrayList<SelectItem>();
allValuesList.add(new SelectItem(1, "India"));
allValuesList.add(new SelectItem(2, "Australia"));
allValuesList.add(new SelectItem(3, "America"));
allValuesList.add(new SelectItem(4, "United Kingdom"));
}
return allValuesList;
}
public void setSelectedValues(List selectedValues) {
this.selectedValues = selectedValues;
}
public List getSelectedValues() {
if (selectedValues == null) {
selectedValues = new ArrayList();
selectedValues.add(1);
selectedValues.add(3);
System.out.println("List is-" + selectedValues);
}
return selectedValues;
}
public void setDisclosedKeys(RowKeySetImpl disclosedKeys) {
this.disclosedKeys = disclosedKeys;
}
public RowKeySetImpl getDisclosedKeys() {
return disclosedKeys;
}
public void prepareLOV(ActionEvent actionEvent) {
disclosedKeys =null;
callDetailStamp();
RowKeySetImpl testDisclosedKey=getDisclosedKeys();
System.out.println("testDisclosedKey before refresh::"+testDisclosedKey);
AdfFacesContext.getCurrentInstance().addPartialTarget(getDataTable());
}
private void callDetailStamp() {
RowKeySet rks = getDataTable().getSelectedRowKeys();
Key currentKey = null;
Object objKey=null;
Iterator rksIter = rks.iterator();
while (rksIter.hasNext())
{
System.out.println("Entered Loop");
objKey=(Object)rksIter.next();
System.out.println("Obj Key::"+objKey);
}
if (rks.size()>0) {
System.out.println("Setting disclosed keys");
disclosedKeys = new RowKeySetImpl();
if (getDataTable() != null) {
ArrayList newKeys = new ArrayList();
ArrayList temp = new ArrayList();
temp.add(0,objKey);
newKeys.add(temp);
disclosedKeys.addAll(newKeys);
}
}
else
{
disclosedKeys = new RowKeySetImpl();
}
System.out.println("Disclosed Key::"+disclosedKeys.toString());
setDisclosedKeys(disclosedKeys);
}
我认为我能够设置disclosureRowKeys属性,因为我能够在输出文本中打印它的值。无论我选择哪一行,我都会将disclosureKeyValue作为特定所选行的索引数组。单击链接集已公开键值并刷新表但不扩展行。我错过了什么吗?