News: Order Styplon Flovent Cheap Zocor Cheap Nexium Female Sexual Cheap Zimulti Ventolin Cheap V-Gel Cheap Avandia Buy Nonoxinol Order Bupropion Reosto Cheap Xanax Cheap Aristocort Feldene Female Viagra Order Tricor Buy Sumycin Purchase Accutane Order Topamax Atrovent Buy Darvocet Cozaar Order Micardis Cheap Himcospaz Sorbitrate Order Reosto Purchase Cephalexin Buying Didrex Buy Aristocort Vytorin Order Dilantin Herbal Maxx Speman Order Omnicef Order Monoket Purchase Methocarbam Cheap Lanoxin Levlen Cheap Valium Order Femara Purchase Atrovent Adipex Purchase Zyvox Purchase Adalat Trandate Cheap Starlix Purchase Lotensin Buy Viagra Cheap Myambutol Cheap Adipex Cheap Zyvox Purchase Nicotinell Buy Famvir Actos Order Zestril Buy Hytrin Purchase Tramadol Eurax Purchase Kamagra Purchase Zovirax Order Mycelex-G Buy Phentermine Evista Buy Coreg Confido Order Zanaflex Purchase Bactroban Cardizem Cheap Tramadol Buy Aldactone Cheap Viramune Cheap Seroquel Cheap Stromectol Purchase Acyclovir Cheap Xeloda Purchase StretchNil Cheap Didronel Purchase Retin-A Crestor Cheap Buspar Cheap Singulair Cheap Inderal Lamisil Cheap Femcare Lopressor Purchase Prozac Buy Karela Purinethol Buy Consultation Order Cardizem Buy Lotensin Purchase Cystone Buy Imitrex Order Paxil Purchase Imdur Buy Lasix Buy Feldene Order Prinivil Buy Antabuse Serophene Buy Desyrel Cheap Allegra Purchase Diazepam Prozac Order Detrol Buy Sorbitrate Buy Bactroban Purchase Codeine Purchase Zetia Cheap Procardia Order Tenuate Lynoral Flonase Buy Parlodel Purchase Amoxil Buy Shallaki Order Prednisone Cheap Clomid Buy Crestor Buy Lopressor Order Lynoral Cheap Geriforte Arimidex Cytotec Order Endep Purchase Actos Cheap Ansaid Order Butalbital Purchase Mexitil Purchase Xanax Buy Menosan Kamagra Buy Viramune Order Protonix Order Altace Buy Valium Purchase Ventolin Purim Omnicef Grifulvin V Order Aceon Cheap Evecare Order Serophene Purchase Aldactone Hoodia Buy Danazol Order Cozaar Buy Zyvox Order CLA Buy Adalat Purchase Avandamet Buy Butalbital Order Nonoxinol Purchase Nolvadex Cheap Sustiva Hydrocodone Cheap Xenacore Zestril Order Neurontin Purchase Cozaar Purchase Altace Cheap Pilex Buy Diakof Purchase Hytrin Order Feldene Buy Trimox Cheap Revia Buy Pravachol Order Ionamin Purchase Cialis Purchase Menosan Fioricet Purchase Femara Purchase Leukeran Purchase Mevacor Order Ultram Prandin Cheap Lorazepam Order Shoot Buy Rocaltrol Order Copegus Wellbutrin SR InnoPran XL Buy Carisoprodol Ultimate Male Urispas Tiberius Erectus Penis Growth Buy Confido Zantac Order Zyprexa Order Hydrocodone Cheap Geodon Flomax Purchase Feldene Buy Lortab Herbal Phentermine Purchase Levothroid Purchase Geodon Cheap Exelon Xanax Order Nicotinell Buy Avapro Cheap Loxitane Cheap Requip Buy Zocor Buy Koflet Cheap Plendil Buy Serevent Buy Diazepam Order Calan Cheap Vasodilan Order Cystone Zocor Order Mexitil Purchase Serophene Purchase Levitra Order Zebeta Purchase Amaryl Buy Superman Cyklokapron Order Ashwagandha Order Zyloprim Buy Lozol Lipitor Cheap Pletal Purchase Rumalaya Purchase Lopressor Cheap Aldactone Buy Styplon Women Attracting Cheap Omnicef Septilin Cheap Tenuate Himcospaz Buy Trazodone Cipro Mexitil Cheap Himcocid Order Famvir Cheap Clarina Cheap Maxaquin Cheap Abana Cheap Confido Buy Purim Order Keftab Buy Bontril Purchase Lasix Buy Celexa Norco Cheap Avandamet Purchase Famvir Purchase Detrol Buy Tramadol Depakote Buying Alprazolam Purchase Celexa Purchase Diflucan Plavix Cheap Norvasc Buy Effects Buy Requip Order Noroxin Zebeta Order Acticin Buy Synthroid Buying Viagra Purchase Neurontin Order Antabuse Purchase Buspar Buy Flomax Coreg Herbolax Order Isordil Cheap Mysoline Cheap Claritin Zimulti SleepWell (Herbal Glucotrol XL Buy Dospan Buy CLA Cheapest Adipex Buy Azulfidine Premium Diet Purchase Hyzaar Buy Seroquel Cordarone Cheap Sinequan Diabecon Order Penisole Buy Renalka Didrex Purchase Singulair Order Biaxin ActoPlus Met Buy Calan Altace Pulmicort Inhaler Buy Allegra Buy Flovent Order Premarin Cheap Tricor Cheap Pravachol Allegra Order Ansaid Buy Prescriptions Order Aristocort Lotensin Purchase Renalka Zyvox Purchase Ashwagandha Acyclovir Cheap Lozol Order Gasex Purchase Emsam Mentax Buy Arimidex Detrol Order Percocet Cymbalta Lorazepam Buy Zyrtec Purchase Speman Cheap Lopid Buy Hyzaar Cheap Aceon Buy Cozaar Buy Rumalaya Purchase Diarex Order Actos Buy Nicotinell Buy Hydrochloride Buy Imdur Zerit Cheap Zerit Buy Dostinex Purchase Prometrium Cheap Nizoral Purchase Prilosec Purchase Oxycontin Buy Serophene Chitosan Cheap Hydrocodone Avodart Purchase Lynoral Cheap Glucophage Ephedrine Buy Cardizem Cephalexin Order Clomid Cheap Pamelor Lukol Order Levlen Buy Snoroff Cheap Azulfidine Buy Fosamax Order Flexeril Purchase Pilex Clomid Purchase Cymbalta Vantin Cheap Feldene Myambutol Purchase Zyban Buy Trandate Cheap Detrol Order Rogaine Buy Zyprexa Cheap Hytrin Purchase Noroxin Cheap Ophthacare Celexa Order Atacand Order Cardura Amaryl Prometrium Cheap Crestor Buy Plavix Order Cipro Purchase Zestril Order Ambien Purchase Lipitor Purchase Proscar Order Lanoxin Order Levitra Order Sinequan Watson Order Pilex Purchase Starlix Cheap Cystone Order Celexa Methocarbam Cheap Famvir Zyban Purchase Augmentin Cheap Methocarbam Purchase Arava Buy Sinequan Toprol XL Order Proventil Cheap StretchNil Buy Differin Norpace CR Cheap Levaquin Nonoxinol Cheap Trandate Buy Zelnorm Purchase Maxaquin Butalbital Cheap Trazodone Cialis Cheap Antabuse Purchase Omnicef Buy Diabecon Purchase Purinethol Proventil Cheap Atarax Cheap Vasotec Purchase Norco Cheap Himplasia Virility Gum Order Diakof Cheap Topamax Oxytrol Buy Eurax Purchase Snoroff Himcolin Buy Tulasi Order Glucophage Cheap Rumalaya Order Amaryl Deltasone Cheap Tenormin Cheap Flonase Purchase Butalbital Cheap Rogaine Micardis Buy Nizoral Darvocet Relafen Buy Prometrium Cheap Lamictal Order Zelnorm Buy Prednisone Buy Sarafem Lasix Cheap Flexeril Buy Biaxin Buy Zovirax Order Flomax Order Ephedrine Buy Shoot Ordering Didrex Cheap Rocaltrol Aldactone Cheap Lariam Loxitane Buy Cyklokapron Buy Cialis Purchase Xenacore Cheap Proventil Buy Vasodilan Buy Stromectol Purchase Lotrisone Order Diarex Order Naprosyn Buy Purinethol Cheap Atacand Buy Loxitane Purchase Oxytrol Cheap Evista Cheap Speman Buy Plendil Purchase Lukol Purchase Parlodel Order Rumalaya Mycelex-G Cheap Quibron-T Geodon Order Flovent Purchase Sumycin Buy Buspar Flexeril Order Geodon Order Prevacid Purchase Sinequan Buy Claritin Buy Capoten Buy Oxycontin Pilex Avandia Buy Soma Purchase Risperdal Purchase Viagra Monoket Order Pamelor Abana Inderal Orgasm Enhancer Cheap Darvocet Diazepam Cheap Urispas Buy Kytril Cheap Penisole Quibron-T Cheap Femara Buy V-Gel Flagyl ER Cheap Micardis Cheap Proscar Buy Celebrex Order Nirdosh Cheap Ambien Lariam Adderall Brafix Purchase Mentax Purchase Percocet Buy Glucophage Acticin Order Prandin Order Mobic Hyzaar Order Elavil Prilosec Trazodone High Love Order Lukol Himcocid Menosan Buy Vantin Order Trazodone Buy Norco Cheap Deltasone Order Oxycontin Buy Zyloprim Cheap Zyrtec Cheap Prinivil Order Ventolin Order Diabecon Order Evecare Buy Lincocin Capoten Purchase Zanaflex Purchase Nizoral Purchase Depakote Purchase Effexor Order Himcolin Purchase Ophthacare Buy Mexitil Order Acomplia Purchase Plavix Order Aldactone Buy Quibron-T Clarina V-Gel Buy Ventolin Buy Emsam Order Nexium Cheap Reosto Purchase Diabecon Diarex Order Dostinex Cheap Menosan Cheap Cephalexin Purchase Lopid Buy Avandia Cheap Prilosec Cheap Cardura Order Lasix Order Azulfidine Cheap Dilantin Order Aricept Order Zyban Order Eurax Cheap Ismo Purchase Loxitane Purchase Synthroid Cheap Rimonabant Purchase Calan Meridia Order Meridia Lioresal Purchase Stromectol Purchase Ansaid Himplasia Dilantin Cheap Monoket Purchase Pamelor Order Differin Order Vantin Buy Fioricet Shuddha Guggulu Sustiva Cheap Danazol Order V-Gel Purchase Evecare Cheap Cordarone Prednisone Order Prometrium Buy Clarina Purchase Triphala Buy Zebeta Effexor Buy Urispas Lexapro Buy Lasuna Cheap Zyprexa Purchase Inderal Cheap Emsam Buy Lexapro Order Prozac Purchase Revia Cheap Lynoral Purchase Zithromax Buy Procardia Cheap Percocet Calan Buy Flexeril Buy Amaryl Zero Nicotine Order High Starlix Mevacor Desyrel Buy Proscar Buy Exelon Noroxin Buy Starlix Cheap Sumycin Cheap Brahmi Purchase Requip Purchase Imitrex Order Brafix Cheap Lasix Buy Depakote Buy Monoket Purchase Sildenafil Lasuna Buy Acticin Order Maxaquin Buy Codeine Purchase Aceon Bactroban Order Kytril Evecare Cheap Noroxin Purchase Clonazepam Order Risperdal Pletal Levaquin Danazol Purchase Chitosan Viramune Rythmol SR Purchase Loprox Purchase Cordarone Cheap Naprosyn Ultram Order Claritin Purchase Ambien Purchase Himcospaz Cheap Celebrex Purchase Purim Buy Arava Order Lotensin Men Attracting Femara Zelnorm Buy Abana Purchase Diakof Bontril Diet Maxx Buy Lotrisone Cheap Prevacid Buy Penisole Purchase Soma Buy Topamax Cheap Norco Cheap Loprox Kytril Buy Lopid Order Bactroban Cheap Ashwagandha Buy Mevacor Purchase Lincocin Order Didrex Cheap Renalka Prevacid Order Zerit Buy Tricor Buy Zithromax Cheap Diazepam Brahmi Cheap Mexitil Cheap Levothroid Order Ophthacare Order Liv.52 Order Himcocid Vitamin A Order Hytrin Purchase Evista Order Xeloda Order Quibron-T Order Stromectol Cheap Cyklokapron Buy Xenacore Aristocort Purchase Phentermine Order Zocor Purchase Lozol Order Lotrisone Cheap Acyclovir Cheapest Generic Hoodia Weght Buy Nolvadex Order Cymbalta Snoroff Soma Cheap Acomplia Synthroid Order Mysoline Cheap Diakof Order Methocarbam Cheap Sarafem Mental Booster Cheap Isordil Buy Aciphex Purchase Zyloprim Order Himcospaz Cheap Acticin Cheap Serevent Buy Lipitor Rimonabant Cheap Lukol Claritin Order Karela Buy Proventil Rhinocort Purchase Lamictal Purchase Sorbitrate Purchase Mycelex-G Order Cephalexin Purchase Rhinocort Buy Aricept Adalat Purchase Ismo Buy Casodex Order Superman Leukeran Viagra Jelly Buy Singulair Order Accutane Cheap Copegus Order Seroquel Order Zetia Purchase Adderall Zyloprim Shoot Order Retin-A Cheap Parlodel Order Prograf Buy Prandin Topamax Karela Buy Speman Buy Prilosec Superloss Multi Purchase Clarina Order Elimite Dostinex Cheap Aciphex Cheap Flomax Menopause Gum Purchase Danazol Order Zyvox Atacand Order Chitosan Order Lincocin Purchase Clomid Buy Cipro Buy Aleve Order Rimonabant Purchase Lasuna Augmentin Buy Atacand Purchase Vasotec Purchase Superman Order Cordarone Purchase Propecia Order Vasodilan Cheap Cipro Buy Herbolax Purchase Meridia Buy Ashwagandha Order Pravachol Order Sumycin Order Ismo Order Triphala Buy Pamelor Purchase Lisinopril Buy Omnicef Purchase Isordil Order Nizoral Purchase Levlen Cheap Alprazolam Buy Phentrimine Cheap Clarinex Order Rocaltrol Buy Geodon Cheap Amaryl Ophthacare Buying Adipex Purchase Sarafem Purchase Combivent Buy Didronel Buy Rogaine Buy Isordil Nexium Cheap Accutane Purchase Biaxin Buy Ephedrine Order Aleve Cheap Diflucan Cheap Nimotop Styplon Buy Atrovent Purchase Atarax Cheap Hoodia Cheap Purinethol Purchase Quibron-T Purchase Herbolax Green Tea Buy Paxil Buy Tenuate Tulasi Cheap Clonazepam Ansaid Purchase Flonase Buy Propecia Hytrin Order Norvasc Purchase Xeloda Cheap Bupropion Cheap Ativan Order Sarafem Cheap Nonoxinol Cheap Zithromax Cheap Zyloprim Buy Avandamet Cheap Lopressor Cheap Chitosan Order Avapro Cheap High Sarafem Buy Adipex Purchase Zocor Order Exelon Purchase Brahmi Purchase Acticin Amoxil Buy Online Buy Prevacid Cheap Retin-A Cheap Adalat Order Accupril Order Valium Order Urispas Purchase Fosamax Buy Revia Buy Deltasone Order Lariam Purchase Karela Buy Prozac Penisole Order Cyklokapron Purchase Nirdosh Levitra Protonix Purchase Abana Cheap Aricept Buy Himcospaz Order Hyzaar Order Coreg Buy Accutane Paxil Loprox Cheap Ephedrine Purchase Clarinex Cheap Levitra Cheap Levlen Diflucan Buy Evecare Cheap Plan Cheap Carisoprodol Purchase Miacalcin Order Lortab Buy Evista Purchase Zimulti Order Cialis Order Brahmi Cheap Brafix Atarax Order Flonase Cystone Mobic Purchase Elimite Order Koflet Fosamax Purchase Koflet Order Depakote Buy Loprox Buspar Rumalaya Forte Glucophage Cheap Tulasi Order Capoten Purchase Nimotop Order Zovirax Cheap Lincocin Lamictal Order Himplasia Premarin Order Avandamet Cheap Cozaar Keftab Lozol Cheap Leukeran Cheap Triphala Buy Rhinocort Order Casodex Purchase Eurax Purchase Flovent Purchase Zantac Cheap Capoten Buy Brite Zovirax Biaxin Purchase Copegus Buy Endep Purchase Shoot Cheap Prednisone Purchase Geriforte Buying Ultram Accutane Purchase Mysoline Cheap Depakote Order Cytotec Purchase Prednisone Lotrisone Purchase Prandin Hair Loss Purchase Ultram Acomplia Purchase Liv.52 Cheap Nicotinell Cheap Diarex Order Sorbitrate Buy Atarax Buy Ophthacare Cheap Prandin Buy Lisinopril Order Herbolax Order Zyrtec Purchase Tenuate Cheap Cymbalta Order Atrovent Order Adalat Buy Vicodin
News Blogs: Sensation! Cigarettes Sale Auto Free Ringtones Balans Credits Åables Soma online Pills, Compare pills, Reviews pills Autos mp3 music for mobile Cases Cars Sportswear Xanax online Free Ringtones furniture Cialis online Dating Replica Rolex Ladies handbag Evening dress Cigarette Online notebook shop Ambien online Yachts Loan Online Chairs FDA Approved Pharmacy Tramadol online Fioricet online Ornaments Blog Search the Web Adipex online Valium online Bracelets Phentermine No Prescription Top auto-moto Fashions Cheap drugs online shop ya.by Green Card Information Ear rings Rolex Replica Mobiles Top casino Boots Chronometer Suits Hydrocodone online Necklace Download Ringtones Free mp3 ringtones auto-moto Rington Underwear Vicodin online Get ringtones online Boats Medicine news Intimate goods

Recent Posts

Archives

Categories

ADF Faces Rich Client - JavaScript Programming Nuggets

Last update: 21 - July- 2008

ADF Faces Rich Client in JDeveloper 11 is a JavaServer Faces UI component set that helps developers to build Ajax applications the smart way without having to dig too much into JavaScript client programming matters.

However, a good framework leaves you the option and so does ADF Faces Rich Client components. You can use the client side framework to actively use JavaScript to raise events or manipulate content. Its the framework itself that provides you hooks and methods for almost everything you can do on the server to do it on the client as well. Of course there are fine lines of best practices not to cross.

ADF Faces RC JavaScript client architecture

JavaScript is not Java! Surprised ? Though JavaScript has Java in its name, it has nothing to do with Java, and in fact doesn't even from the same company. For many years JavaScript had been banned from enterprise client application development because of alleged security risks.

Ajax however made it possible to bring JavaScript back into spotlight, without the security concerns being lifted. As it seems the web developer community is more feature driven than security paranoid and so they happily waved away the security concerns. I don't go into this discussion ,but in fact I agree that you can relax on this matter. Not on security in general, but on the possibility of a widened attack surfaced through the use of JavaScript in Ajax, compared to traditional web applications. Stay on your security watch towers, but don't mind Ajax.

In Ajax, JavaScript is used for what only a few new it was possible and the majority wasn't even interested: Object oriented programming! Most of know JavaScript from alerts that popup in HTML forms or dependent list boxes that work so nicely on online registration forms. However, there is more to master in Ajax than this.

[... TBC ... ]

Adding JavaScript on a page

Before JavaScript can do its little wonders, you need to get it onto the page first. For this the following markup can be added below the af:document tag

XML:
  1. <![CDATA[
  2.             <script>
  3.                  /* if called from a client listener */
  4.                 function name(event) { }
  5.                 /* ordinary JavaScript function */
  6.                 function name1 () { }
  7.                 ...
  8.           </script> ]]>

Best practices is to add JavaScript into the metaContainer facet of the af:document element

XML:
  1. <f:view>
  2.   <af:document>
  3.   <f:facet name="metaContainer">
  4.       <af:group>
  5.         <![CDATA[<script>function name(_event) {
  6.         ...
  7.          }       
  8.           </script> ]]>
  9.       </af:group>
  10.     </f:facet>
  11.     ...
  12.   </af:document>
  13. </f:view>

Basic Usecases

Basic usecases explain how to access a specific information from the ADF Faces Rich client framework. JavaScript savvy developers will be able to use the published the code snippets in their own ADF Faces RC applications.

Detecting the client browser agent

ADF Faces Rich Client framework allows developers to determine the version of the client agent used with an application. The agents that can be specified are

XML:
  1. <f:verbatim>
  2.         <![CDATA[
  3.             <script>
  4.                 function whichAgent(event) {       
  5.                     agent = AdfAgent.getAgent();
  6.                     if(agent.constructor == AdfGecko18Agent){
  7.                         alert("Mozilla");
  8.                     }
  9.                     if(agent.constructor == AdfIEAgent){
  10.                         alert("IE");
  11.                     }
  12.                }
  13.           </script> ]]>
  14.      </f:verbatim>

Getting the x/y position of a mouseclick on a component

If you know how to get the x/y coordinates of a mouseclick in JavaScript then you might be surprised to see that your favorite technique fails in ADF Faces RC. The reason for this is that if the event comes from a client listener in ADF Faces, the event object is one of ADF Faces RC

XML:
  1. <f:view>
  2.     <af:document>
  3.      <f:verbatim>
  4.         <![CDATA[
  5.             <script>
  6.                 function handleMouseCoordinates(event) {       
  7.                 alert("x: "+event.getPageX()+" y: "+event.getPageY());
  8.                }
  9.             </script>
  10.         ]]>
  11.     </f:verbatim>
  12.       <af:form>
  13.         <af:commandButton text="My Click Button" icon="/images/jdev_cup.gif">
  14.           <af:clientListener method="handleMouseCoordinates" type="click"/>
  15.         </af:commandButton>
  16.       </af:form>
  17.     </af:document>
  18.   </f:view>

Getting the keycode of the pressed key

The key event in ADF Faces is a subclass of AdfDomAdfAdfUIInputEvent and provides a cross browser functionality to obtain the pressed key e.g in an input field.

To call a JavaScript function - e.g. whichkey - you need to add an af:clientListener in the jspx page for the input component, e.g. af:textField

XML:
  1. <af:inputText label="Autosuggest">
  2.           <af:clientListener method="whichkey" type="keyUp"/>
  3.         </af:inputText>

This invokes the following JavaScript added to or linked from the page

XML:
  1. <![CDATA[
  2.             <script>
  3.                 function whichkey(event) {                   
  4.                     alert(event.getKeyCode());                   
  5.                 }
  6.           </script>
  7.        ]]>

If the executing agent is Firefox, then the event class is "AdfGeckoAdfAdfUIInputEvent", if the agent is IE then the event class is "AdfIEUIInputEvent".

Accessing the content of a selected table row

Tables in ADF Faces Rich client components are stamped for performance reasons. This means that they are built on the server and don't use a client object for the table rows, columns and cells they contain. If a developer needs to access the content of the selected table cell on the client, or the content of selected table cells in a multi select table, then there is an option to do so, which includes the declarative creation of such objects. As a note of caution, keep in mind that any client object you create for an ADF Faces application will have its impact on performance when rendering the page. In Ajax, the penalty for two many client objects is download size.

When you create the ADF Faces table - e.g. by dragging and dropping a ViewObject from the ADF data control palette onto the JSF page - then you not only decide whether or not the table should be read-only, but also, if the table rows should become selectable. The latter is what usually you want. Note that if you missed setting the select option in the ADF binding editor, you can always define this in the component properties.

Making a table selectable doesn't notify any JavaScript on the client, which is why an additional component, the af:clientListener is required. The af:clientListener component dispatches the table selection to a JavaScript method whenever a pre-defined event - selection in this case - happens.

XML:
  1. <af:table value="#{bindings.DepartmentsView1.collectionModel}" var="row"
  2.              rows="#{bindings.DepartmentsView1.rangeSize}"
  3.              first="#{bindings.DepartmentsView1.rangeStart}"
  4.              emptyText="#{bindings.DepartmentsView1.viewable ? 'No rows yet.' : 'Access Denied.'}"
  5.              fetchSize="#{bindings.DepartmentsView1.rangeSize}"
  6.              selectedRowKeys="#{bindings.DepartmentsView1.collectionModel.selectedRow}"
  7.              selectionListener="#{bindings.DepartmentsView1.collectionModel.makeCurrent}"
  8.              rowSelection="single">
  9.              <af:clientListener method="showDepartmentsName" type="selection"/>
  10. ...

The client listener in the above example calls a JavaScript method "showDepartmentsName" and passes in the event object, which is of AdfSelectionEvent type. The AdfSelectionEvent class hierarchy, in case you are interested, is

XML:
  1. AdfPhasedEvent
  2.    |   
  3.    |-AdfRowKeySetChangeEvent
  4.                    |
  5.                    |- AdfSelectionEvent

The AdfPhaseEvent's getSource() method, gives us a handle to the table component - as the source of the event. The table component has a method findComponent("name",rowKey) that allows us to search for a specific client component that it contains.

The client component in a read only table is those of a outputTextField, which represents a table cell. The client components, as mentioned before, don't exist by default and are created by setting the "clientComponent" property to true.

XML:
  1. <af:column sortProperty="DepartmentName" sortable="false">
  2.       <af:outputText value="#{row.DepartmentName}"
  3.        clientComponent="true"
  4.        id="dname"/>
  5.    </af:column>

The two lines - defining clientComponent = true and id=" dname" - make it possible that the department name is rendered in a client object, which is accessible by the name "dname".

To access the content of the selected dname table cell, we can now call

var cellhandler = _theTable.findComponent("dname",firstRowKey);

The full "showDepartmentsName" JavaScript is

XML:
  1. <f:verbatim>
  2.         <![CDATA[
  3.             <script>
  4.                 function showDepartmentsName(event) {
  5.                     var _theTable = event.getSource();
  6.                     rwKeySet = event.getAddedSet();
  7.                     for(rowKey in rwKeySet){
  8.                         firstRowKey = rowKey;
  9.                         // we are interested in the first hit, so break out here
  10.                         break;
  11.                     }
  12.                
  13.                     var cellhandler = _theTable.findComponent("dname",firstRowKey);
  14.                
  15.                     if (cellhandler != null){
  16.                         alert (cellhandler.getValue());
  17.                     }
  18.                 }