/**
* To set focus in first field in af:table
*
*/
public static void setFocusInTableFirstField(RichTable table, String componentId) {
FacesContext facesContext = FacesContext.getCurrentInstance();
String tableId = table.getClientId(facesContext);
RowKeySet rks = table.getSelectedRowKeys();
String inputId = null;
if (rks != null && rks.size() > 0) {
Object rowKey = rks.iterator().next();
String rowId = table.getClientRowKeyManager().getClientRowKey(facesContext, table, rowKey);
inputId = tableId + ":" + rowId + ":" + componentId;
System.out.println("@@ClientId Value:" + inputId);
} else {
// handle error
}
ExtendedRenderKitService service = Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext,
" var comp = AdfPage.PAGE.findComponent('" + inputId + "');" + " if(comp!=undefined){ comp.focus(); } ");
}
and call this method in any button action
setFocusInTableFirstField(getT3(), "soc6");