Technology: ADF11g
Developed in: JDeveloper 11.1.1.3.0
Browsers tested: Firefox 3.6.13 and Internet explorer 7 (7.0.6002.18005)
Used database schema: HR
Used tables: EMPLOYEES
Summary
In this blog a solution is provided how to trigger an action on enter. An action can be a command link or button. All defined actions (action, actionListener, showPopupBehaviour) will be executed when the user uses the enter.
To trigger an action set the defaultCommand property of the af:form tag. Set the value to the ID of the button / link that should be triggered on action.
We’ll use the following page in this blog:
This page is based on the EMPLOYEES table in the HR schema. The table is created by drag and drop from the Data control palette. An edit (commandLink) column is added to navigate to a form of the employee. The page contains 2 buttons, a Cancel which navigates back to the home page and create an insert which creates a now employee row and navigates to the form.
Trigger a button
In this example we’ll trigger the Cancel button, the cancel button asks for confirmation and if the user answers with OK it navigates back to the home page.
The button looks like this:
<af:commandButton text="Cancel"
id="cancel"
immediate="true">
<af:resetActionListener/>
<af:showPopupBehavior popupId="cancelPopup"
triggerType="action"/>
</af:commandButton>
<af:form id="f1">
<af:form id="f1" defaultCommand="pt1:cancel">
When we run this and we press enter you get:
Trigger a link
In this example we’ll trigger the Edit command link, the link contains an actionListener which adds an information message to the stack and an action which navigates to the form.
First set the current row of the view object by selecting a row:
Then when enter is pressed:
The commandLink for this example looks like this:
<af:column headerText="Edit employee"
id="c12">
<af:commandLink text="Edit"
id="cl5"
actionListener="#{employeeBean.edit}"
action="edit"/>
</af:column>
<af:form id="f1" defaultCommand="pt1:t1:cl5">
The employeeBean refers to a request scoped bean that contains an edit method:
public void edit(ActionEvent actionEvent) {
EmployeesViewImpl view = getService().getEmployeesView();
String name = view.getCurrentRow().getAttribute("FirstName") + " " + view.getCurrentRow().getAttribute("LastName");
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Edit", "Edit person: " + name.trim()));
}
private static HrAppModuleImpl getService() {
DCBindingContainer bc = (DCBindingContainer)FacesContext.getCurrentInstance().getApplication().evaluateExpressionGet(FacesContext.getCurrentInstance(), "#{bindings}", BindingContainer.class);
DCDataControl dc = bc.findDataControl("HrAppModuleDataControl");
return (HrAppModuleImpl) dc.getDataProvider();
}
2015-10-8leilei
BeantwoordenVerwijderennike trainers
Michael Kors Outlet
coach outlet
ugg boots sale
Kobe Bryant Shoes On Sale
michael kors handbags
nike shorts,nike hoodies,nike town,new nike shoes,nike tennis shoes,air max 97,nike shop,nike basketball
michael kors outlet online
ray-ban wayfarer
Louis Vuitton Handbags
Canada Goose Jackets/Coats And Parka Online
Michael Kors Handbags Clearance
Ugg Boots Outlet Clearance,Cheap Uggs On Sale Discount For Women
uggs sale
Michael Kors Outlet Online Free Shipping
michael kors outlet
canada goose jackets
michael kors uk
michael kors uk
Coach Factory Outlet Store Online
Jordan 4 Retro For Sale
Coach Outlet Coach factory
michael kors bags
ray-ban sunglasses,ray ban sunglasses,ray bans,rayban,ray ban wayfarer,raybans,ray ban glasses,ray ban aviators,ray ban clubmaster,ray ban eyeglasses,cheap ray bans,ray bans sunglasses,ray ban aviator,ray bands,fake ray bans,ray ban prescription glasses,ray ban outlet,ray ban canada,ray ban sunglasses sale,ray ban sale
Hollister Cheap Hollister Clothing Outlet Store
canada goose outlet,canada goose jackets,canada goose online,canada goose sale
coach outlet online
louis vuitton
ugg outlet
Michael Kors Handbags Outlet