... <af:table value="#{bindings.CountryView2.collectionModel}" var="row" rows="#{bindings.CountryView2.rangeSize}" selectedRowKeys="#{bindings.CountryView2.collectionModel.selectedRow}" selectionListener="#{bindings.CountryView2.collectionModel.makeCurrent}" partialTriggers="::ctbAddCountry ::ctbDelCountry" rowSelection="single" id="t5" rowDisclosureListener="#{CrudsBean.disclosureListenerCountry}" binding="#{CrudsBean.CountryTable}" > ...
En el backing bean deberíamos tener una propiedad del tipo RichTable el cual es enlazado desde la vista(#{CrudsBean.CountryTable}) y la acción que se invoca para añadir un registro en la colección que muestra la tabla(ctbAddCountryAction), el código final sería algo como por ejemplo:
... RichTable CountryTable; public void setCountryTable(RichTable empTable) { this.CountryTable = empTable; } public RichTable getCountryTable() { return CountryTable; } public String ctbAddCountryAction() { String ret = ejecutaBinding("CreateInsert", false); Row selectedRow = (Row)EL.get("#{bindings.CountryView2Iterator.currentRow}"); RowKeySet rks = getCountryTable().getDisclosedRowKeys(); List keyList = Collections.singletonList(selectedRow.getKey()); rks.add(keyList); return ret; } ..
Después de esto cada vez que añada un registro en la colección que muestra la tabla (Countries), esta desplegará el detailStamp del registro activo.
Enlaces relacionados:
Getting all selected rows in ADF Table with multiple rows selection enabled
ADF UI - selectionListener example for single-select af:table
- FIN -
No comments:
Post a Comment