From richfaces-svn-commits at lists.jboss.org Tue Nov 27 11:30:36 2007 Content-Type: multipart/mixed; boundary="===============6714878209228335436==" MIME-Version: 1.0 From: richfaces-svn-commits at lists.jboss.org To: richfaces-svn-commits at lists.jboss.org Subject: [richfaces-svn-commits] JBoss Rich Faces SVN: r4290 - trunk/docs/faq/en/src/main/docbook/module. Date: Tue, 27 Nov 2007 11:26:36 -0500 Message-ID: --===============6714878209228335436== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: artdaw Date: 2007-11-27 11:26:36 -0500 (Tue, 27 Nov 2007) New Revision: 4290 Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml Log: RF-1422 - fix 'How to get row selection in scrollableDataTable using one an= d multi-selection rows mode?' section in FAQ Modified: trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2007-11-27 16:25:0= 2 UTC (rev 4289) +++ trunk/docs/faq/en/src/main/docbook/module/RFCfaq.xml 2007-11-27 16:26:3= 6 UTC (rev 4290) @@ -368,14 +368,15 @@
How to pass own parameters during a modalPanel open= ing or closing? - You can pass your parameters during modalPanel open= ing or closing. This passing could be - performed in the following way: - = + You can pass your parameters during modalPanel open= ing or closing. This + passing could be performed in the following way: <= /para> + Example: - Thus, except the standard modalPanel parameters you= can pass any of your own parameters. + Thus, except the standard modalPanel parameters you= can pass any of your own + parameters.
=
@@ -756,8 +757,8 @@
What should I change on the server side? - The list of zones to be reRendered can be specified= as EL - expression. But there is a question that must be s= pecified more exactly. + The list of zones to be reRendered can be specified= as EL expression. But + there is a question that must be specified more ex= actly. The list of Ids is formed during beforePhase of REN= DER_RESPONSE. Therefore, in this case one can point reRender to the Set typ= e Bean's property and fill the Set during a tracking request. @@ -1116,10 +1117,11 @@ attribute to bind the rowKeys to be re= Rendered there. After you need to point reRender on the specific rows. - "ajaxKeys" - attribute defines strings that are updated aft= er an Ajax request. It provides - possibility to update several child components sep= arately without updating the whole page. - = + "ajaxKeys" + attribute defines strings that are upd= ated after an Ajax + request. It provides possibility to update several= child components + separately without updating the whole page. + @@ -1139,66 +1141,126 @@
- How to get row selection in scrollableDataTable usi= ng one and multi-selection rows mode? - The - "selection" - attribute is a reference to object to the inst= ace of org.richfaces.model.selection.Selection interface, con= taining current selection. - In order to get the row data in one and multi-select= ion rows mode you should use = - the "selection" attribute and then work up the selection in particular wa= y. - - = - - - - - - - - - - - - - - - - - - - - -... -]]> - In order to get data from selection you can create a managed bean like this one. + How to get row selection in scrollableDataTable usi= ng one and multi-selection + rows mode? + In order to get row selection in scrollableDataTable= using one and + multi-selection rows mode you s= hould use the + "selection" + attribute. + In the following example when user submits the form = current collection of + objects selected by user is placed in the object's= property. Then on + complete action the + <rich:modalPanel> + with selected data will be shown. + + Example: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + X + + + + + + + + + + + + + + + + + + + + + + +...]]> + In order to build this application, you can create a= managed bean like this + one. Function + takeSelection() + fills the array selectedCars= with the data, + got from the selection. Funct= ion + getSelectedCars() + returns the array selectedCa= rs, which is + used for filling + <rich:dataTable> + with selected row/rows data. + + Example: + + selectedCars =3D new ArrayList(); = - = - ... - = - public SimpleSelection getSelection() { - return selection; - } - = - public String takeSelection() { - getSelectedCars().clear(); - Iterator iterator =3D getSelection().getKeys(); - while (iterator.hasNext()){ - SimpleRowKey key =3D iterator.next(); - getSelectedCars().add(getAllCars().get(key.intValue())); - } - return null; - } - - public ArrayList getSelectedCars() { - return selectedCars; - } -... -]]> + private SimpleSelection selection =3D new SimpleSelection(); + private ArrayList selectedCars =3D new ArrayLis= t(); = + ... + public SimpleSelection getSelection() { + return selection; + } + public void setSelection(SimpleSelection selection) { + System.out.println("Setting Started"); + this.selection =3D selection; + System.out.println("Setting Complete"); + } + public String takeSelection() { + getSelectedCars().clear(); + Iterator iterator =3D getSelection().getKeys= (); + while (iterator.hasNext()){ + SimpleRowKey key =3D iterator.next(); + getSelectedCars().add(getAllCars().get(key.intValu= e())); + } + return null; + } + public ArrayList getSelectedCars() { + return selectedCars; + } + public void setSelectedCars(ArrayList selectedC= ars) { + this.selectedCars =3D selectedCars; + } +} +...]]> + Some additional information about usage of one and multi-selection + rows mode can be found here.
--===============6714878209228335436==--