1) In your jsff page add the following tag:
<f:verbatim><input id="buttonId" type="hidden" /><verbatim>1.1) Also add the following to the tag you want to double click:
<af:clientListener method="executeButton" type="dblClick"/>
2) Add the following javascript:
function executeButton(event) { var tbl = event.getSource(); if (tbl.getSelectedRowKeys() != null) { var btn = AdfPage.PAGE.findComponent(document.getElementById("buttonId").value); if (btn != null) { AdfActionEvent.queue(btn, false); } event.cancel(); } }
3) Bind your button to a backing bean:
private RichCommandToolbarButton button; public void setButton(RichCommandToolbarButton button){ FacesContext fctx = FacesContext.getCurrentInstance(); Service.getRenderKitService(fctx, ExtendedRenderKitService.class).addScript(fctx, "document.getElementById(\"buttonId\").value = '" + editButton.getClientId(FacesContext.getCurrentInstance()) + "'"); this.button = button; } public RichCommandToolbarButton getButton(){ return button; }
Comments
Post a Comment