Hello all,
I'm new to ADF and I'm trying to learn how selection event handling works. The problem I am facing is I would like the enable/disable a button(ctb1) based on a selection events from partialTriggers on my table(t1). To do this I created a table (t1) and my button listens for trigger events to update its state(enable/disabled). The issue I am seeing is when I attempt to grab a hold of the current row selection it seems to be returning data from the first row every time (for example, I click on the third row in my table, and instead of getting data from the third row I get data from the first row, click on second row same thing)
Below is the code for my table and button:
When My page renders it seems it gets the first row of my table and when I select another row its grabbing the first row data every time. I also notice that when I select the first row in this table no selection event is fired (i.e the partialTrigger on ctb1 is never fired).
<af:commandToolbarButton text="#{resourceuiBundle.EnableDisabledBtn}"
id="ctb1"
disabled="#{!viewScope.ManagedModelBean.testEnabled}"
partialSubmit="true"
icon="/images/awesomeImage.png"
actionListener="#{ManagedBean.doSomething}"
partialTriggers="t1"/>
<af:table value="#{bindings.EmployeeROVO.collectionModel}"
var="row"
rows="#{bindings.EmployeeROVO.rangeSize}"
summary="#{resourceuiBundle.SOMEAWESOMESUMMARY}"
emptyText="#{bindings.EmployeeROVO.viewable ? resourceuiBundle.NO_DATA_TO_DISPLAY : resourceuiBundle.ACCESS_DENIED}"
fetchSize="#{bindings.EmployeeROVO.rangeSize}"
rowBandingInterval="1"
selectedRowKeys="#{bindings.EmployeeROVO.collectionModel.selectedRow}"
selectionListener="#{bindings.EmployeeROVO.collectionModel.makeCurrent}"
rowSelection="single" id="t1"
columnStretching="last"
binding="#{ManagedBean.targetTable}"
visible="#{ManagedBean.tableVisible}">
<af:column sortProperty="TargetName" sortable="true"
headerText="#{bindings.EmployeeROVO.hints.TargetName.label}"
id="c1" rowHeader="unstyled" width="300">
<af:panelGroupLayout id="pgl5">
<af:image id="i2"
source="#{ImageMap.targetType16[row.TargetType]}"
shortDesc=""/>
<af:spacer width="2" height="10" id="s4"/>
<af:outputText value="#{row.TargetName}" id="ot9"/>
</af:panelGroupLayout>
</af:column>
<af:column sortProperty="TargetStatus" sortable="true"
headerText="#{bindings.EmployeeROVO.hints.TargetStatus.label}"
id="c4">
<af:outputText value="#{row.TargetStatus}" id="ot8"/>
</af:column>
<af:column sortProperty="SetNameLabel" sortable="true"
headerText="#{bindings.EmployeeROVO.hints.SetNameLabel.label}"
id="c3">
<af:outputText value="#{row.SetNameLabel}" id="ot5"/>
</af:column>
<af:column sortProperty="UserName" sortable="true"
headerText="#{bindings.EmployeeROVO.hints.UserName.label}"
id="c2">
<af:outputText value="#{row.UserName}" id="ot4"/>
</af:column>
</af:table>
For got to add here is the call I'm making via my mbean to grab the current selection in my table:
private Row getCurrentRowSelection() {
String employeeIterator = "bindings.EmployeeROVOIterator";
DCBindingContainer bc = (DCBindingContainer) getBindingContainer();
return bc.findIteratorBinding(employeeIterator).getCurrentRow();
}
Binding for my tree.
<bindings>
<tree IterBinding="EmployeeROVOIterator"
id="EmployeeROVO">
<nodeDefinition DefName="oracle.sysman.core.security.uimodel.view.EmployeeROVO"
Name="EmployeeROVO0">
<AttrNames>
<Item Value="TargetName"/>
<Item Value="TargetType"/>
<Item Value="SetName"/>
<Item Value="CredGuid"/>
<Item Value="CredOwner"/>
<Item Value="CredName"/>
<Item Value="SetnameNlsid"/>
<Item Value="SetNameLabel"/>
<Item Value="IsCredSet"/>
<Item Value="UserName"/>
<Item Value="TargetStatus"/>
</AttrNames>
</nodeDefinition>
</tree>
<action IterBinding="EmployeeROVOIterator"
id="ExecuteWithParams" RequiresUpdateModel="true"
Action="executeWithParams">
<NamedData NDName="QueryTargetName"
NDValue="#{viewScope.managedModelBean.targetName}"
NDType="java.lang.String"/>
<NamedData NDName="QuerySetName"
NDValue="#{viewScope.managedModelBean.setName}"
NDType="java.lang.String"/>
<NamedData NDName="QueryTargetType"
NDValue="#{viewScope.managedModelBean.targetType}"
NDType="java.lang.String"/>
</action>
</bindings>
Running jdev: 11.1.1.6.0
Also, kind of a side question. Should a table selection even occur on render when table attribute selectedRowKeys="#{bindings.EmployeeROVO.collectionModel.selectedRow}" is set? Otherwise how can I grab a hold of the current selection after the page render?
Thanks in advance for the help,
Wraith
Edited by: wraith101 on Aug 13, 2012 1:43 PM
Edited by: wraith101 on Aug 13, 2012 2:01 PM
Edited by: wraith101 on Aug 13, 2012 4:05 PM
Added in missing binding attribute.
Edited by: wraith101 on Aug 14, 2012 8:39 AM