0

I am trying to capture keypress event for "ENTER" key for input box inside ADF editable table. I have added client listener and server listener and have the JavaScript code for the input box inside af:resource tag.

The requirement is as follows - I have a editable table with total of 6 columns but only first and last columns are editable. So when user enters a value in first column and hits enter I need to populate some data from some other business component and fill the other columns.

I am able to capture the enter keypress event, but when I am using chrome after the server side method is called the row focus is automatically moved to next row in the table. Can someone tell me how to stop this on the table. This happens only in chrome. The code works fine in firefox and IE.

4

1 回答 1

0

您可以根据要求通过 javascript 将焦点设置在您需要的字段上。但是您需要知道要设置焦点的组件的客户端 ID。在您的事件处理程序中调用它:

String clientId = ...
String script = "AdfPage.PAGE.findComponent('" + clientId + "').focus();";
FacesContext context = FacesContext.getCurrentInstance();
Service.getRenderKitService(context,
    ExtendedRenderKitService.class).addScript(context, script);

script处理响应时将在客户端上调用。

于 2013-06-27T11:03:53.897 回答