Author: cluts
Date: 2008-02-19 05:25:01 -0500 (Tue, 19 Feb 2008)
New Revision: 6153
Modified:
trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-2147 - How to select one row of a dataTable by
clicking on it, even if clicked in an inputText of this row
Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml
===================================================================
--- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-19 00:31:04 UTC (rev
6152)
+++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2008-02-19 10:25:01 UTC (rev
6153)
@@ -1460,7 +1460,7 @@
<section id="RowSelectionInDataTable">
<?dbhtml filename="HighlightRowDataTable.html"?>
<title>How to highlight rows in a dataTable when the mouse is
over?</title>
- <para>In order <property>to highlight rows in a dataTable
when the mouse is over</property> you should use
<emphasis><property>"onmouseover"</property></emphasis>
and
<emphasis><property>"onmouseout"</property></emphasis>
attributes. </para>
+ <para>In order to highlight rows in a dataTable when the mouse is
over you should use
<emphasis><property>"onmouseover"</property></emphasis>
and
<emphasis><property>"onmouseout"</property></emphasis>
attributes. </para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -1553,4 +1553,42 @@
</section>
+ <section id="OneRowSelectionInDataTable">
+ <?dbhtml filename="HighlightRowDataTable.html"?>
+ <title>How to select one row of a dataTable by clicking on it, even
if clicked in an inputText of this row?</title>
+ <para>In order to select one row of a dataTable by clicking on it
you could use JavaScript function described below. </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<script type="text/javascript">
+ var oldRow;
+ function changeColor(row)
+ {
+ if (oldRow!=undefined)
+ {
+ oldRow.style.backgroundColor='#ffffff';
+ }
+ row.style.backgroundColor='#ffff00';
+ oldRow=row;
+ }
+</script>
+...]]></programlisting>
+ <para>Then you could use <emphasis
role="bold"><property>a4j:support</property></emphasis>
with
<emphasis><property>"event"</property></emphasis>
and
<emphasis><property>"onsubmit"</property></emphasis>
attributes.</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<h:form>
+ <rich:dataTable cellpadding="0" cellspacing="0"
+ width="700" border="0"
var="record" value="#{report.expReport.records}">
+ <a4j:support event="onRowClick"
onsubmit="changeColor(this)" ajaxSingle="true">
+ <f:param name="currentRow"
value="#{record.city}"/>
+ </a4j:support>
+ ...
+ </rich:dataTable>
+</h:form>
+...]]></programlisting>
+ </section>
+
</chapter>