4 Replies Latest reply on Jun 9, 2010 9:42 PM by kiran7881

    DataGrid column shown as HyperLink using htmlText

    kiran7881 Level 1

      Hi ,

       

      Sincere apologise for posting this Thread .

       

      I feel shame to post this question as without any efforts , but dont have any other option as all sites at my work place are blocked
      except the technology providers .

       

       

      Can anybody post a  sample code where a particular column of  DataGrid is shown as a Hyper Link using htmlText .

       

      I want to know how to use an Item Renderer in this case .

       

      still Hoping for  the best .

      Thanks for reading .

        • 1. Re: DataGrid column shown as HyperLink using htmlText
          Matt Le Fevre Level 4
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
              
              <mx:XML id="siteXML" xmlns="">
                  <root>
                      <item>
                          <name>Google</name>
                          <link>http://www.google.com</link>
                      </item>
                      <item>
                          <name>Adobe</name>
                          <link>http://www.adobe.com</link>
                      </item>
                      <item>
                          <name>Yahoo</name>
                          <link>http://www.yahoo.com</link>
                      </item>
                  </root>
              </mx:XML>
              
              <mx:DataGrid dataProvider="{siteXML.item}" x="23" y="57" width="402" height="281">
                  <mx:columns>
                      <mx:DataGridColumn headerText="Name">
                          <mx:itemRenderer>
                              <mx:Component>
                                  <mx:Label text="{data.name}"/>
                              </mx:Component>
                          </mx:itemRenderer>
                      </mx:DataGridColumn>
                      <mx:DataGridColumn headerText="Clickable Site Link">
                          <mx:itemRenderer>
                              <mx:Component>
                                  <mx:Label htmlText="&lt;u&gt;{data.link}&lt;/u&gt;" color="blue" click="newBrowserWindow(data.link)">
                                      <mx:Script>
                                      <![CDATA[
                                      
                                      private function newBrowserWindow(url:String):void 
                                      {
                                          var urlRequest:URLRequest = new URLRequest(url);
                                          navigateToURL(urlRequest, "_blank");
                                      }
                                          
                                      ]]>
                                      </mx:Script>
                                  </mx:Label>
                              </mx:Component>
                          </mx:itemRenderer>
                      </mx:DataGridColumn>
                  </mx:columns>
              </mx:DataGrid>
          </mx:Application>
          

           

          try that

          • 2. Re: DataGrid column shown as HyperLink using htmlText
            kiran7881 Level 1

            Thanks very much ,

             

            Is it possible to have  aActionScript class , instead of using a MX:XML ???

            • 3. Re: DataGrid column shown as HyperLink using htmlText
              Matt Le Fevre Level 4

              i only used MX:XML as an example, so yeah you could have an arrayCollection, XMLList etc..., anything a datagrid that could have as its dataprovider

              • 4. Re: DataGrid column shown as HyperLink using htmlText
                kiran7881 Level 1

                Ya , i could write a ArrayCollection for that .

                Keep up the good work mate .

                Thank you very much .