How to open a link by clicking on a DataGrid row

I have a list of documents that are accessible over the internet.  The list is in an XML file which serves as the data source for a DataGrid.  What I cannot figure out is how to open the document selected in the DataGrid.  I think that I need to change something in the openDocument function (below) but I am not certain what I should change.  Any help would be appeciated.
Sample file are below:
Application
viewDocuments.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="initApp();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.core.Application;
[Bindable]
private var documents:ArrayCollection;
private function initApp():void
this.srv.send();
private function onResult(evt:ResultEvent):void
this.documents=evt.result.data.document;
private function openDocument():void
var docURL:String;
docURL=dgDocuments.selectedItem.url;
navigateToURL(new URLRequest("http://cnn.com/"), "_blank");
//Below does not work
//navigateToURL(new URLRequest("docURL"), "_blank");
]]>
</mx:Script>
<mx:HTTPService id="srv"
url="documents.xml"
resultFormat="object"
result="onResult(event)"/>
<mx:Canvas id="cViewDocumentsContainer"
x="0"
y="0"
width="100%"
height="100%">
<mx:DataGrid id="dgDocuments"
width="600"
height="186"
dataProvider="{documents}"
x="15"
y="74"
doubleClickEnabled="true"
doubleClick="openDocument();">
<mx:columns>
<mx:DataGridColumn headerText="DocID"
dataField="doc_id"
visible="true"/>
<mx:DataGridColumn headerText="Name"
dataField="name"
visible="true"
width="200"/>
<mx:DataGridColumn headerText="Type"
dataField="type"
visible="true"
width="90"/>
<mx:DataGridColumn headerText="File Name"
dataField="filename"
visible="true"/>
<mx:DataGridColumn headerText="Path"
dataField="url"
visible="true" width="200"/>
</mx:columns>
</mx:DataGrid>
<mx:Text x="10"
y="10"
text="View Documents"
fontSize="12"
fontWeight="bold"/>
<mx:Text x="15"
y="48"
text="Double-click on the document below you want to read. The document will open in a new window."/>
</mx:Canvas>
</mx:Application>
Data
documents.xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<document>
<doc_id>1</doc_id>
<name>CNN</name>
<type>URL</type>
<filename>CNN.com</filename>
<url>http://cnn.com/</url>
</document>
<document>
<doc_id>2</doc_id>
<name>Yahoo</name>
<type>URL</type>
<filename>Yahoo.com</filename>
<url>http://yahoo.com/</url>
</document>
</data>
Thanks!
Lee

You need this (removed double quotes):
navigateToURL(
new URLRequest(docURL), "_blank");
If this post answers your question or helps, please mark it as such.
Greg Lafrance
www.ChikaraDev.com
Flex Development and Support Services

Similar Messages

  • I have some trouble with Safari!  Everytime i google something, I expect safari to open the link i click in the same window and same tab - as it did before - but now it always opens a new tab! I'm getting really tired of that! So please help me!

    I have some trouble with Safari! 
    Everytime i google something, I expect safari to open the link i click in the same window and same tab - as it did before - but now it always opens a new tab! I'm getting really tired of that! So please help me! I want safari to open the google search link in the same window and tab! How to fix that?
    Please help me!!!
    Thank you!

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.

  • FF 6.0 doesn't open pdf-links, after clicking on "open pdf" error message says file not supported or damaged. IE opens file all right. Please advice.

    Firefox 6.0 doesn't open pdf-links after clicking on "open pdf". I frequently need to do literature searches and I need to view pdf files in the browser. After clicking on the pdf - link of a file the main options are to open or download the pdf. Every time I try to open a pdf-file a blank page and an error message appears saying the file would not be supported or is damaged. IE, however, opens the file all right. I tried various changes in the security and cookie settings without success. Please advice.

    Hi SGckc,
    This document is almost certainly a dynamic XFA form. Unfortunately, our mobile Reader does not support displaying or filling such forms. The application that produces this form embeds this message into the document so that non-supportive viewers (like ours) will display this "error" page when the document opens. I do realize that this is confusing and I would like to add some additional detection to our Reader for this case. However, we've avoided doing this for fear of confusing users even further. Your feedback helps though. Hopefully we'll find a way to detect this case and present a better message to the user like: This form is not supported by the mobile version of the Adobe Reader. Please open and fill it on the non-mobile version of the Adobe Reader for Windows, Linux or Mac OSX.
    Thank you for contacting us!
    Pat

  • How to open particular link or content in new tab

    how to open particular link or content in new tab.... as in ipad we just continue pressing and a option comes that open in new tab... exactly when i tried in macbook .....i was not able to do.... didn't find the answer after googling also. please suggest?

    Check your browser preferences.
    ex Safari>Preferences>General>

  • C++ How to know what link is clicked on a Balloon tooltip after handle the TTN_LINKCLICK message

    switch (msg) {
    case WM_NOTIFY:
    NMHDR* nmhdr = (LPNMHDR)lparam;
    switch(nmhdr->code) {
    case TTN_LINKCLICK:
    <code>
    return TRUE;
    I'm able to trap the TTN_LINKCLICK notification. However I would like to retrieve the URL text link that was clicked.
    How to know what link is clicked on a Balloon tooltip after handle the TTN_LINKCLICK message ?
    MCunha

    Basically you don't know what link was clicked.  If you need more than one link, you may need to use a different UI element to display it, like a dialog or some sort of other popup window that you have control over.

  • How to open a PDF on click of a link

    Hi All,
    I have a requirement to open a PDF on click of a link on a PG.
    Should I use the Destinaion URL property???
    Where should the PDF be placed on Server???
    like eg. for .gif images we use ........java/oracle/apps/media on server
    Thanks
    Sombit.

    Generally one should use web exposed folders to save custom files like anything under $OA_HTML, can be directly opened as a link in browser. However, in cases the file is saved in a particular location in apllication unix server ,and you have full path to it, you can refer to blog entry to give user the download of file option :
    http://mukx.blogspot.com/2010/01/giving-download-option-to-user-for-file.html
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to open a link automatically in a new tab rather than right click and select open in a new tab?

    no details

    To open a link or Bookmark in a new tab, you can:
    *press the mouse scroll wheel on a link or Bookmark
    *hold down the CTRL key while left-clicking the link or Bookmark
    See:
    *http://www.7is7.com/software/firefox/shortcuts.html
    *https://support.mozilla.org/en-US/kb/Mouse%20shortcuts
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.org/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *'''''Adobe PDF Plug-In For Firefox and Netscape''''': [https://support.mozilla.org/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.org/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • How to open a link in a Window NOT a Tab in OS X Mountain Lion

    For those of you who Hate having links open in tabs, especially when you have a window open and minimized to your doc.  The link will take that
    minimized window and use it to stick a tab in it and then open the link........WHAT A PAIN!
    Here's how to avoid that problem and have the links open in a Brand New Window.
    Safari/Preferences/Tabs
    Uncheck both boxes
    Now, the instructions below change to window instructions (not tab instructions)
    See the little window to the right of:  Opens pages in tabs instead of windows:  Click the little arrows and select NEVER! 
    Now you have to insert a checkmark in the 1st box:  (Butterfly) - click opens link in a new tab
    The below instructions will revert back to tab instructions, Do Not Worry.  All Is Good.
    The fact that you have selected NEVER, means that NOW, the links will open in Brand New Windows!  Yeah!!!
    Close the Preference Window and click away. 

    vveena123 wrote:
    Hi everyone,
    I immediately need help,plz help me.this is not the way to get help around here
    try stating the problem professionally, without the assumption that your problem is important to others
    I have a jsp which has a link that should open in a new window.
    when the user clicks again the same link it should not open in another new window instead it should open the previous window.this has nothing to do with java or jsp
    this is an html target question
    testing
    say if a user clicks the link 5 times it shud not open 5 windows instead only 1
    Thanks in advanceuse target="new" i think

  • How to open form links in new window in Acrobat XI

    Does anyone know how to have a link within a form open a new instance of a browser?

    Answered through email:
    Hello,
    I don´t understand your problem. You have not tried the component mentioned in my replies, right? You have tried Launch URL component from WD Native. Because if you have, you would ask such a question. This component is a u201Cgroupu201D of a text field and a button. That means, that fits your problem completely IMHO. Place the component on your form layout, Set the presence of the text fox inside this Launch URL and you will see what address is being launch when clicked on the button.
    You said you have your address in the text field. So this is the same. Just change the source where the button takes the URL from or copy the value from your form into this one.
    Hope this helps.
    p.s.: looks like you have absolutely no exerience with JS coding.
    That means you need to read first and code later, right? Start here: http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_basics.pdf

  • How to open the link in new firefox window for web desktop based application? Or how to open the mail/website/rss link in new firefox window

    I am using the firefox 3.6. My problem is that I am using the web desktop and few web desktop based application directly opens link. If I click on rss link than it opens in same window, so no longer access to web desktop. I want to open any kind of link in new window instead of same window. I have tired to change the value of browser.link.open_newwindow, browser.link.open_newwindow.restriction but doesn't work. Also gone through the https://developer.mozilla.org/en/window.open but not sure where to do this in web desktop based application or firefox where we connect the web desktop?
    Is there any way to open the link every time in new firefox window?

    Hi Joseph,
    the HTMLB link object misses the support for onClientClick through the tag lib, see hbj:link without onClientClick ? and OnClientClick Event for Link HTMLB Component for similiar problems and workarounds.
    With this workaround, you can call for example an AbstractPortalComponent, implement doOnNodeReady (with an empty doContent method) and return the PDF, settings the content type on the http before etc.
    Hope it helps
    Detlev
    PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

  • How to Open External Links in a New Tab

    I want links in web pages to open in the current tab so I have browser.link.open_newwindow=1. But how do I make links from extenal applications open in a new tab?

    Try setting the following to 3, not really sure if preference was actually removed or just won't accept 2, the intent was that the two variables be the same (I think)
    browser.link.open_external -- Where to open links sent to the browser from an external application
    * 2 (default in SeaMonkey): Opens external links in a new window
    * 3 (default in Firefox): Opens external links in a new tab in the most recent window
    * 1 (or anything else): Opens external links in current window
    Note: In Firefox 2 and above, via “Tools → Options → Tabs → New pages should be opened in:” (same as browser.link. open_newwindow)
    Pref removed from Firefox 3.5

  • How to open external links in new tabs?

    I own a personal web site. A question is
    How to open external site in the new tab? For example: the THIS LINK will open new window. How to open new tab in Safari for this case?
    Thanks for answer.

    Morning Igor and welcome to the forum.
    I assume that you are talking about enabling the tabs in the preferences of safari:
    Preferences, tabs, open new windows in tabs (I believe this is how it is written.. not in front of my mac).
    Hope this helps...
    Steff

  • Urlbar not opening up links when clicked

    I'm not sure of the exact name, but the URL bar or the location bar where links are stored when you click the drop down error it shows recent links or in my case most used links from my Bookmarks. I used to be able to click on a link from there and it would open the page, now I have to click on it and hit enter or use the middle mouse button to open the link in a new window.

    Nevermind. The 7.0.1 update fixed it.
    Thanks anyway.
    Picture of success :
    !http://i5.tinypic.com/8fn20c9.png!
    Message was edited by: LeonardoGolden

  • How to open a link inside shell.

    There are workset items in ux3.shell in ui5. I have given a http link in setContent method of one of the worksetitem. This link is opening but in new window and not inside the shell. But i want to open that link inside the shell.

    JS Bin - Collaborative JavaScript Debugging
    mContent[id] = new sap.ui.core.HTML({content : " <iframe id='myExternalLink' style='width:100%;height:100%;z-index:-1' width='100%' height='100%' src='http://go.sap.com/index.html'></iframe>" });

  • How to Open GUI Transaction when clicking in Hyper Link

    Hello All,
    I want to open GUI Transaction  when user will click on Hyper Link created in a particular column in a table view. For that I have created  Transaction Launcher ID using Transaction Launcher  Wizard. Then what will be the next step, i'm not getting. Can anybody help me out on this?
    Thanks in advance,
    Madhusudan

    Hi,
    Here is the sample code:
    DATA: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
    lr_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
    CHECK lr_navigation IS BOUND.
    lr_navigation->navigate( iv_link_id = 'ZLINKID' ).
    -ASB

Maybe you are looking for

  • How to default value in collection after intial collection field entered

    Hi there, Am working on gettting to know collections but not really had much to do with them so far. I have a multi row data entry screen that works great using a collection. Now the boss has decided that the new records require a default value that

  • Yes/No using personalized printer e-mail?

    I'm assuming HP has a problem on their end with the new printer e-mail personalization, but whom do you notify? I have two c310a printers that worked until I personalized their e-mail address when the service became available-now I get a return e-mai

  • Unable to download from memory card to photoshop elements 6

    I get "downloading device list....please wait, but it never does download. Any suggestions? I use windows vista Thanks

  • Help me please!!! lightsnake usb guitar gb2

    I have been using Garageband ever since I've recieved my iBook about a year and a half ago. Ive been using it with a lightsnake (guitar input / usb) and ive been getting fair results with it, and then one day... poof. every time I try to connect it t

  • [mouseEvent] CPU Grab

    I have a sample application with 400 column charts below. (I am attempting to duplicate behavior noticed in a heavily databound 80-chart app.) If I allow my mouse pointer to hover over the application container (not the charts themselves--but the gut