Passing dynamic parameters to the Java Script method in a Fusion Web Application
In this post, I'm sharing some tips to pass dynamic parameters values to a Java Script method. The idea is inspired by an example from Frank Nimphius. Solution is to use <af:clientAttribute> to associate the parameter and value with the component which triggers the event. When using af:clientAttribute the parameter can be accessed on the client through AdfUIComponent.getProperty("ParameterName"). The rich client framework takes care of marshaling the attribute value to the client. Also, the below code uses 'closure' in the JavaScript method to ease the coding.
<af:resource type="javascript">
function someMethod(arg) {
return function (evt) {
var finalArg = evt.getSource().getProperty('SomeDynamicArg') + ' : ' + arg;
alert(finalArg);
evt.cancel();
}
}
</af:resource>
<af:commandButton text="SomeActionBtn" id="cb1">
<af:clientListener type="click"
method="someMethod('SomeStaticArg')"/>
<af:clientAttribute name="SomeDynamicArg"
value="#{bindings.DepartmentName.inputValue}"/>
</af:commandButton>
How do we access the client attributes on server side ?
ReplyDeleteThanks for sharing this great article! That is very interesting I love reading and I am always searching for informative articles like this.
ReplyDeleteStruts Training in Chennai
Struts Training Chennai
Best Struts Training in Chennai
WordPress course
Wordpress Training institute in Chennai
Struts Training in Adyar
struts Training in Anna Nagar
Nice content and blog...Thanks for sharing, Waiting for next...
ReplyDeleteWordpress Training in Chennai
Wordpress Training Chennai
Wordpress Training Institutes in Chennai
wordpress training in Thiruvanmiyur
Wordpress Training in Velachery
Struts Training in Chennai
clinical sas training in chennai
Spring Training in Chennai
Photoshop Classes in Chennai
LoadRunner Training in Chennai
Content Writing Company in Delhi
ReplyDeleteContent Writing Services in Delhi
Mobile App Development Company Delhi
PPC Company in Delhi
PPC Company in India
The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
ReplyDeletewebsite development Pakistan
Thanks for your blog!!.
ReplyDeleteJAVA Development Services
HR Pay Roll Software
Hotel Billing Software
Web Design Company
Hospital Management Software
SAP Software Services