4 Replies Latest reply on Jul 4, 2009 4:01 AM by hkpadobe

    Component Renderer Error

    hkpadobe

      I am using a Component Renderer with the following code:

      <?xml version="1.0" encoding="utf-8"?>

      <mx:LinkButton

       

      xmlns:mx="http://www.adobe.com/2006/mxml"

      label="

      Click Here"

      click="(navigateToURL(

      new URLRequest(data.url));)"/>

       

       

       


      and am getting the follwing error:

      The markup in the document following the root element must be well-formed. Test2/src urlRenderer.mxml Unknown 1246607471187 11626


      In my main app file I have a datagrid with 3 columns with the 3rd column using the Renderer.

       

      Any suggestions.

       

      Thanks,

       

      J

        • 1. Re: Component Renderer Error
          hkpadobe Level 1

          Here's the main app file and urlRenderer that I am using these were found as examples on the web, but the urlRenderer is giving the error as mentioned earlier.

           

          Main App

          ?xml version="1.0"?>

           

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white" backgroundGradientColors="[0xFFFFFF, 0xFFFFFF]">

           

          <mx:Script>

          <![CDATA[

           

          import mx.collections.ArrayCollection;

           

          import flash.net.navigateToURL;

          [

          Bindable]

           

          public var myAC:ArrayCollection = new ArrayCollection([

          {firstName:

          "Jon",lastName:"Hirschi",url:"http://www.flexablecoder.com"},

          {firstName:

          "Tariq",lastName:"Ahmed",url:"http://www.dopejam.com"}

          ]);

           

          ]]>

           

          </mx:Script>

           

           

          <mx:DataGrid id="dg" width="700" height="100" dataProvider="{myAC}">

           

          <mx:columns>

           

          <mx:DataGridColumn dataField="firstName" headerText="First Name"/>

           

          <mx:DataGridColumn dataField="lastName" headerText="Last Name"/>

           

          <mx:DataGridColumn headerText="URL" itemRenderer="urlRenderer"/>

           

          </mx:columns>

           

          </mx:DataGrid>

           

           

          </mx:Application>

           

           

           

           

          urlRenderer

          <?xml version="1.0" encoding="utf-8"?>

          <mx:LinkButton

           

          xmlns:mx="http://www.adobe.com/2006/mxml"

          label="

          Click Here"

          click="(navigateToURL(

          new URLRequest(data.url));)"/>

           

           

           


          Thanks,

           

          J

          • 2. Re: Component Renderer Error
            hkpadobe Level 1

            I tried using the following code in my itemRenderer:

            <?xml version="1.0" encoding="utf-8"?>

            <mx:LinkButton

             

            xmlns:mx="http://www.adobe.com/2006/mxml"

            label='

            Hello World'

            textDecoration="

            underline" fontWeight="normal"

            click="navigateToURL(

            new URLRequest('http://www.yahoo.com'))" />

             

             

             

             

            I do see my datagrid when I run my application but the original data in my column is overwritten by 'Hello World'. If I leave the label field out then I don't see any data but if I click on any rows in the column I do navigate to url as shown. If I don't use the itemRenderer than I do see my original data in the column.

             

            How do I make my original data in the column be visiable and be used as a linkbutton so that I can click on the data to launch the url?

             

            Thanks,

             

            J

            • 3. Re: Component Renderer Error
              rgadiparthi Level 2

              use

              <mx:DataGridColumn headerText="URL" dataField="url"/>

              instead

              <mx:DataGridColumn headerText="URL" />

              1 person found this helpful
              • 4. Re: Component Renderer Error
                hkpadobe Level 1

                Hi rgadiparthi,

                 

                Your advice helped. Can you help with the other issue I have that when I use the urlRenderer the original column names are not shown, so a way of showing them.

                 

                Thanks,

                 

                J