2 Replies Latest reply on Jun 13, 2010 4:45 AM by anxious33

    How to specify that a field in a datagrid is an URL ?

    anxious33

      Hello,

       

      in my datagrid i've a field which contains a single URL. How to make it clickable and open the url in the browser ?

       

      Thanks

        • 1. Re: How to specify that a field in a datagrid is an URL ?
          David_F57 Level 5

          hi,

           

          protected function dataGrid_itemClickHandler(event:ListEvent):void

          {

          var str:String=dataGrid.columns[event.columnIndex].dataField;

          switch(str)

          {

          case 'nom':

          getServeurByNameResult.token = serveurService.getServeurByName(event.itemRenderer.data.nom);

          break;

          case 'siteweb':

          navigateToURL( new URLRequest(event.itemRenderer.data.siteweb),'_blank');

          break;

          }

          }

          now you can update the second grid if you click on the nom cell and got to the url if you click on the siteweb cell.
          You no longer need a click on datagrid event use itemClick instead.
          <mx:DataGrid x="23" y="82" width="965" height="237" id="dataGrid"
          itemClick="dataGrid_itemClickHandler(event)"
          creationComplete="dataGrid_creationCompleteHandler(event)"
          dataProvider="{getAllServeurResult.lastResult}">
          David.

          • 2. Re: How to specify that a field in a datagrid is an URL ?
            anxious33 Level 1

            awesome, thanks for your reply