1 Reply Latest reply on Dec 1, 2009 1:17 PM by =VA=FyreHeart

    Dynamic Hyperlinks in DataGrid/AdvancedDataGrid

    =VA=FyreHeart Level 2

      Forgive me, but when the web was build around hyperlinked text, it should be easier to create hyperlinks in a Rich INTERNET Application.

      Ok - enough griping. I do have a legit question:

       

      For historical reasons, I have to construct hyperlinks from a number of parameters passed in the URL (aka GET params). Since I write reporting systems, those hyperlinks usually have to appear in a table of some sort: a DataGrid or AdvancedDataGrid.

       

      My typical code looks something like this:

      <mx:Application blah=blah>

           <mx:Script>

                <![CDATA[

                ]]>

           </mx:Script>

       

           <mx:HTTPService id="getStuff" method="get" url="http://www.example.com/getData.php" result="processServerData(event)"/>

           <mx:AdvancedDataGrid blah=blah>

                <mx:columns>

                     <mx:AdvancedDataGridColumn blah=blah itemRenderer="ADGcustomItemRenderer"/>

                </mx:columns>

           </mx:AdvancedDataGrid>

      </mx:Application>

        • 1. Re: Dynamic Hyperlinks in DataGrid/AdvancedDataGrid
          =VA=FyreHeart Level 2

          OK, I didn't mean to post that yet. Why can't I edit my post?

          Anyways...

           

          <mx:Application blah=blah>

               <mx:Script>

                    <![CDATA[

                         import a.bunch.of.stuff

           

                         protected function onInitialize():void {

                              getStuff.send();

                         }

                    ]]>

               </mx:Script>

           

               <mx:HTTPService id="getStuff" method="get" url="http://www.example.com/getData.php" result="processServerData(event)"/>

               <mx:AdvancedDataGrid blah=blah>

                    <mx:columns>

                         <mx:AdvancedDataGridColumn blah=blah dataField="dataFieldName" itemRenderer="ADGcustomItemRenderer"/>

                    </mx:columns>

               </mx:AdvancedDataGrid>

          </mx:Application>

           

          ADGcustomItemRenderer.mxml

          <mx:Canvas blah=blah>

           

               <mx:Script>

                    <![CDATA[

                         import mx.controls.dataGridClasses.DataGridColumn;
                     
                      [Bindable] protected var myURL :String;
                      override public function set data(value:Object):void {
                              myURL = '<a href="http://www.example.com/dosomething.php?dept_num=00000&vendor='+value['dataFieldName']+'" target="_blank">'+value['VendorName']+'</a>';
                      }

                    ]]>

               </mx:Script>

               <mx:Text htmlText="{myURLl}" height="100%" width="100%" />

          </mx:Canvas>

           

          Notice the dept_num? I need to pass that data to the itemRender, since it can change from page to page (though not row by row) in addition to the column-specific data passed via the "value" object. How can I access that data from the custom itemRenderer?

           

          Thanks