2 Replies Latest reply on Sep 10, 2008 12:26 PM by @logg57

    Dynamic Popups?

      Hello Everyone,
      I am Currently working on a Project,and I have Scoured the Search engines,and forums,and blogs,for Days.
      I am stuck on something fairly simple i would suppose.
      Heres what im trying to accomplish,

      I have a datagrid in flex 2.0/flex builder 2.0.

      Heres what she looks like,

      <mx:DataGrid height="208" id="vb" dataProvider="{videoblog}" variableRowHeight="true" width="370" editable="false">
      <mx:DataGridColumn headerText="Video Blog">
      <mx:VBox verticalGap="2">
      source="{data.art}" height="50" width="50" click="" buttonMode="true" />
      <mx:LinkButton label="{data.artist + ' ~ ' + data.title}"/>

      Ok so this datagrid is rendering items from an xml object.
      <mx:XML id="videoblog" source="main.xml"/>

      heres what my xml looks like.


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

      The problem im having is that the datagrid only shows 1 xml tem,and not the two.
      does anyone know what Im doing wrong?

      Is the xml structure off?
      I must be forgetting something,

      Any kind help would be greatly appreciated
        • 1. Re: Dynamic Popups?
          ntsiii Level 3
          That is not valid xml. It has no root node.

          Post the full xml, or fix it.

          Then, specify the dataProvider like this:

          • 2. Dynamic Popups?
            Hi, I think I add the same problem.

            First, that's better to call your XML file with an HTTPService request.

            Another thing, when your dataProvider is defined like {videoblog}, you don't need to call your data like {data.artist}, you can just write {artist} I think, I advise you to display just one variable in one { }, not two. (i don't know why)

            BUT, a better way to display several variables is to use the itenRenderer property of your dataGridColumn.

            Take this sample with an AdvancedDataGrid:

            1)create an mxml component called myRenderer.mxml, the base component could be a VBox, that will display your data.
            2)insert the components you need inside the <mx:application> tag, your component myRenderer.mxml should be like that :

            <?xml version="1.0" encoding="utf-8"?>
            <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml"
            width="100%" horizontalAlign="left"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"
            <mx:Label id="lblArtiste" text="{data.artiste}" />
            <mx:LinkButton label="{data.artist +' '+ data.title}"/>

            3) Then, you should ask your dataGrid to call the myRenderer.mxml.

            <mx:AdvancedDataGridColumn headerText="Video Blog" width="150" dataField="artiste" itemRenderer="applications.Renderer.myRenderer"/>

            The link should be chosen from the root of your application, in this case myRenderer.mxml is on the field applications/Renderer/myRenderer.mxml