Author: vkorluzhenko
Date: 2007-07-09 09:37:48 -0400 (Mon, 09 Jul 2007)
New Revision: 303
Modified:
trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
Log:
http://jira.jboss.com/jira/browse/RF-421
Improved discription for jsFunction. Added ways of usage and link to example.
Modified: trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml 2007-07-07 01:16:15
UTC (rev 302)
+++ trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml 2007-07-09 13:37:48
UTC (rev 303)
@@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter>
-
- <table>
- <title>Component identification parameters </title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Name</entry>
- <entry>Value</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>component-type</entry>
- <entry>org.ajax4jsf.ajax.Function</entry>
- </row>
- <row>
- <entry>component-family</entry>
- <entry>org.ajax4jsf.components.AjaxFunction</entry>
- </row>
- <row>
- <entry>component-class</entry>
- <entry>org.ajax4jsf.ajax.html.HtmlAjaxFunction</entry>
- </row>
- <row>
- <entry>renderer-type</entry>
- <entry>org.ajax4jsf.components.AjaxFunctionRenderer</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
+
+ <table>
+ <title>Component identification parameters </title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.ajax4jsf.ajax.Function</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>org.ajax4jsf.components.AjaxFunction</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.ajax4jsf.ajax.html.HtmlAjaxFunction</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.ajax4jsf.components.AjaxFunctionRenderer</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
<section>
<title>Creating on a page</title>
<para>Simple component definition example:</para>
@@ -45,10 +45,9 @@
<a4j:jsFunction data="#{bean.someProperty}" name="callScript"
oncomplete="myScript(data.subProperty1, data.subProperty2)"/>
...]]>
</programlisting>
- <para>
- The script "myScript" will be called after
<property>bean.someProperty</property> data
- will be returned from server(e.g. It'll be object with two subproperties).
- </para>
+ <para> The script "myScript" will be called after
+ <property>bean.someProperty</property> data will be returned from
server(e.g. It'll
+ be object with two subproperties). </para>
</section>
<section>
<title>Dynamical creation of a component from Java code</title>
@@ -60,11 +59,55 @@
</section>
<section>
<title>Key attributes and ways of usage</title>
- <para>
- As the component uses Ajax request to get data from server - it has all
- common Ajax Action attributes. So, action and actionListener can be
- invoked, and reRendering some parts of the page fired after calling
- function.
- </para>
- </section>
-</chapter>
\ No newline at end of file
+ <para> As the component uses Ajax request to get data from server - it has all
common Ajax
+ Action attributes. So, action and actionListener can be invoked, and reRendering
some parts of
+ the page fired after calling function. </para>
+ <para> When using the <emphasis role="bold">
+ <property><a4j:jsFunction></property>
+ </emphasis> it's possible to initiate the AJAX request from the
JavaScript and
+ perform partial update of a page and/or invoke the JavaScript function with data
returned by
+ AJAX response. </para>
+ <programlisting role="XML"><![CDATA[...
+<body onload="callScript()">
+ ...
+ <h:form>
+ ...
+ <a4j:jsFunction name="callScript" data="#{bean.someProperty1 }
+ "reRender="someComponent"
oncomplete="myScript(data.subProperty1, data.subProperty2)">
+ <a4j:actionparam name="param_name"
assignTo="#{bean.someProperty2}">
+ </a4j:actionparam>
+ </a4j:jsFunction>
+ ...
+ </h:form>
+ ...
+</body>
+...]]></programlisting>
+ <para> The <emphasis role="bold">
+ <property><a4j:jsFunction></property>
+ </emphasis> allows to use <emphasis role="bold">
+ <property><a4j:actionparam></property>
+ </emphasis> or pure <emphasis role="bold">
+ <property><f:param></property>
+ </emphasis> for passing any number of parameters of the JavaScript function
into AJAX request.
+ <emphasis role="bold">
+ <property><a4j:jsFunction></property>
+ </emphasis> is similar to <emphasis role="bold">
+ <property><a4j:commandButton></property>
+ </emphasis>, but it could be activated from the JavaScript code. It allows to
invoke some
+ server side functionality and use the returned data in the JavaScript function
invoked from
+ "oncomplete" attribute. So it's possible to use
<emphasis
+ role="bold">
+ <property><a4j:jsFunction></property>
+ </emphasis> instead of <emphasis role="bold">
+ <property><a4j:commandButton></property>
+ </emphasis>. You can put it anywhere, just don't forget to use
+ <h:form> … </h:form> around it. </para>
+ </section>
+ <section>
+ <title>Relevant resources links</title>
+ <para> To see how <emphasis role="bold">
+ <property><a4j:jsFunction></property>
+ </emphasis> works on practice, look at a4j-jsFunction example from <ulink
+
url="http://labs.jboss.com/jbossajax4jsf/demo/index.html">he...
+ </section>
+</chapter>