Populate datagrid problem

Hi there
I am having problems populating my datagrid with xml data
returned from an instance of a class.
Here is the xml data that is returned from the instance
<summaryScreen>
<exam>
<type>GCE</type>
<qualification>Extended Project
Qualification</qualification>
<code>1991</code>
<students>12</students>
<marked>4</marked>
<submitted>8</submitted>
<series>november</series>
</exam>
<exam>
<type>GCE</type>
<code>1991</code>
<qualification>Extended Project Qualification -
TH</qualification>
<students>14</students>
<marked>3</marked>
<submitted>4</submitted>
<series>september</series>
</exam>
<exam/>
</summaryScreen>
And here is my code for the datagrid
<mx:DataGrid
dataProvider="{_summaryScreenData.getXMLData()}">
<mx:columns>
<mx:DataGridColumn headerText="Type" dataField="type"
width="60" />
<mx:DataGridColumn headerText="Qualification"
dataField="qualification" width="140"/>
<mx:DataGridColumn headerText="Code" dataField="code"
width="140" />
<mx:DataGridColumn headerText="Students"
dataField="students" width="70" />
<mx:DataGridColumn headerText="Marked" dataField="marked"
width="70" />
<mx:DataGridColumn headerText="Submitted"
dataField="submitted" width="90"/>
<mx:DataGridColumn headerText="Series" dataField="series"
width="70"/>
<mx:DataGridColumn headerText="Days Left"
dataField="daysLeft"/>
</mx:columns>
</mx:DataGrid>
Can anyone point me in the right direction to get this data
into the datagrid?
Thanks!

Hi,
please look at your XML there is a extra and wrong
"<exam/>" closing tag.
still you have a problem. Plz look at the code which I tried
it worked fine.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Model id="xyz">
<summaryScreen>
<exam>
<type>GCE</type>
<qualification>Extended Project
Qualification</qualification>
<code>1991</code>
<students>12</students>
<marked>4</marked>
<submitted>8</submitted>
<series>november</series>
</exam>
<exam>
<type>GCE</type>
<code>1991</code>
<qualification>Extended Project Qualification -
TH</qualification>
<students>14</students>
<marked>3</marked>
<submitted>4</submitted>
<series>september</series>
</exam>
</summaryScreen>
</mx:Model>
<mx:Script>
<![CDATA[
import mx.utils.ArrayUtil;
]]>
</mx:Script>
<mx:DataGrid
dataProvider="{mx.utils.ArrayUtil.toArray(xyz.exam)}">
<mx:columns>
<mx:DataGridColumn headerText="Type" dataField="type"
width="60" />
<mx:DataGridColumn headerText="Qualification"
dataField="qualification" width="140"/>
<mx:DataGridColumn headerText="Code" dataField="code"
width="140" />
<mx:DataGridColumn headerText="Students"
dataField="students" width="70" />
<mx:DataGridColumn headerText="Marked" dataField="marked"
width="70" />
<mx:DataGridColumn headerText="Submitted"
dataField="submitted" width="90"/>
<mx:DataGridColumn headerText="Series" dataField="series"
width="70"/>
<mx:DataGridColumn headerText="Days Left"
dataField="daysLeft"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>

Similar Messages

  • ArrayCollection to populate Datagrid

    Hi,
    Im having problems getting my own array data to bind to a
    dataGrid. I've tried formating my array data several ways but none
    work. Here is an example of one of the iterations i have tried
    which i beleive should work. I build my array like this ...
    for(i) {
    arrayName.push( [{ fieldName1: value
    , fieldName2: value}] );
    which gives me a nice 2d array. this is put in an
    arrayCollection which is bindable....
    arrayCol = new ArrayCollection( arrayName);
    and it is set as the dataProvider for my grid and the
    fieldNames are set as the column dataFields ...
    <mx:DataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true" enabled="true"
    dataProvider="{arrayCol}">
    <mx:columns>
    <mx:DataGridColumn headerText="Tag"
    dataField="fieldName1" editable="false"/>
    <mx:DataGridColumn headerText="Tag Value"
    dataField="fieldName1" editable="true"/>
    </mx:columns>
    </mx:DataGrid>
    The dataGrid does populate in the sense that i am allowed to
    select the rows; the number of rows that my array consists of ...
    however the cells are empty. I've spent a fair time trying to work
    this out and search the docs / this forum. If anyone has any
    recommendations about how to bind array / arrayCollection data to a
    dataGrid it would be greatly appreciated.
    Regards

    The way you have it structured, it looks like you have a
    two-dimensional array
    where the second dimension always just contains a single
    item. Unless I'm
    misinterpreting your goal, the way to change this would be to
    remove the extra
    left/right brackets in your arrayName.push:
    change
    arrayName.push( [{ fieldName1: value<i> , fieldName2:
    value<i>}] );
    to
    arrayName.push( { fieldName1: value<i> , fieldName2:
    value<i>} );
    That way, you have a one-dimensional array, but each item in
    that array has a
    field named 'fieldName1' and another field named
    'fieldName2'.
    Here is a complete sample that works for me (with the latest
    internal build --
    I haven't tried beta 3):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="initData()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    public var mydata:Array;
    [Bindable]
    public var arrayCol:ArrayCollection;
    private function initData():void
    mydata = [];
    mydata.push( { fieldName1: '1', fieldName2: '2' } );
    mydata.push( { fieldName1: '3', fieldName2: '4' } );
    arrayCol = new ArrayCollection(mydata);
    ]]>
    </mx:Script>
    <mx
    ataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true"
    enabled="true" dataProvider="{arrayCol}">
    <mx:columns>
    <mx
    ataGridColumn headerText="Tag" dataField="fieldName1"
    editable="false"/>
    <mx
    ataGridColumn headerText="Tag Value"
    dataField="fieldName2"
    editable="true"/>
    </mx:columns>
    </mx
    ataGrid>
    </mx:Application>
    Mike Morearty
    Developer, Flex Builder team
    http://www.morearty.com/blog
    McDusty wrote:
    > Hi,
    >
    > Im having problems getting my own array data to bind to
    a dataGrid. I've tried
    > formating my array data several ways but none work. Here
    is an example of one
    > of the iterations i have tried which i beleive should
    work. I build my array
    > like this ...
    >
    > for(i) {
    > arrayName.push( [{ fieldName1: value<i> ,
    fieldName2: value<i>}] );
    > }
    >
    > which gives me a nice 2d array. this is put in an
    arrayCollection which is
    > bindable....
    >
    > arrayCol = new ArrayCollection( arrayName);
    >
    > and it is set as the dataProvider for my grid and the
    fieldNames are set as
    > the column dataFields ...
    >
    > <mx
    ataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true"
    > enabled="true" dataProvider="{arrayCol}">
    > <mx:columns>
    > <mx
    ataGridColumn headerText="Tag" dataField="fieldName1"
    > editable="false"/>
    > <mx
    ataGridColumn headerText="Tag Value"
    dataField="fieldName1"
    > editable="true"/>
    > </mx:columns>
    > </mx
    ataGrid>
    >
    > I've spent a fair time trying to work this out and
    search the docs / this
    > forum. If anyone has any recommendations about how to
    bind array /
    > arrayCollection data to a dataGrid it would be greatly
    appreciated.
    >
    > Regards
    >

  • ItemRenderer and DataGrid Problem

    Hi guys.
    I'm on creating a small app that simply pulls information
    from an XML file, displays it in a DataGrid then allows the user to
    filter and search it. First things first though; I'll explain what
    I have so far then detail my problem.
    I get the XML file via HTTPService then place the results in
    a Bindable ArrayCollection. When the Datagrid's source is set to
    that ArrayCollection it works fine. What I am initially trying to
    do is use an itemRenderer in one of the columns that displays lines
    of text depending on the values of the current row.
    For example, the structure of my XML file is (roughly):
    <content>
    <name>Name1</name>
    <description>Description Goes Here</description>
    <audience1>yes</audience1>
    <audience2>no</audience2>
    <audience3>yes</audience3>
    </content>
    So what I am trying to do is group the audiences that each
    piece of "content" has a yes value to. So under the "Audiences"
    column in the datagrid, the above content would say
    "Audience1
    Audience3"
    as it has a yes value in between audience 1 and 3. I've tried
    writing very basic code within the itemRenderer whereby I override
    the public function set data and do some checks there but it never
    seems to work right. I've tried using Arrays within that to store
    the current audiences but I clearly haven't got the right format
    for that.
    There must be a more efficient way of doing this. I'm fairly
    new to both Flex and AS3 (been using AS2 quite a while now) but I
    have a feeling there would be some way to store each row's audience
    list in an array/object/model so I can refer to it later (I'm
    intending to filter these results by audience type later so I think
    I will HAVE to do it this way eventually). I've read quite a few
    tutorials and guides but I honestly don't know where to look
    anymore, none of them seem to cover this specific problem.
    I hope this makes sense to you guys and any guidance you
    could give me would be greatly appreciated.
    Cheers

    LabelFunction produces a display-only column.
    To filter, you will need to use the underlying data.
    Another solution to consider is to create a custom item
    class. Loop over the xmllist and build instances of the class,
    populating the properties from the xml.
    have a property who's value is calculated based on the
    audience properties values. Since it is a "real" data property in
    each item, you can filter on it directly.
    Tracy

  • Datagrid problem

    hi all
    how r u
    i have a small problem in datagrid and hope any one help me
    i created a datagrid that each row can has its own color i used this code
    package Models
          import flash.display.Sprite;
          import mx.collections.ArrayCollection;
          import mx.controls.DataGrid; 
         public class myDataGrid extends DataGrid 
             private var _coloredRowIndex:int; 
             private var _rowColorCode:uint; 
             private var _setColorRowIndex:Boolean;  
             public function set setColorRowIndex(b:Boolean):void 
                 _setColorRowIndex = b;            
             public function get setColorRowIndex():Boolean 
                 return _setColorRowIndex; 
             public function set coloredRowIndex(i:int):void 
                 _coloredRowIndex = i; 
             public function get coloredRowIndex():int 
                 return _coloredRowIndex; 
             public function set rowColorCode(colorValue:uint):void 
                 _rowColorCode = colorValue; 
             public function get rowColorCode():uint 
                 return _rowColorCode; 
             override protected function drawRowBackground(s:Sprite,rowIndex:int,y:Number,height:Number,color:uint,dataIndex:int):void 
                try{
                         if(setColorRowIndex == true) 
                     if(rowIndex == coloredRowIndex) 
                         color = rowColorCode; 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                     else 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                 else 
                     if((dataProvider as ArrayCollection).getItemAt(rowIndex,0).status==0) 
                         color = 0xffffff; 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                     else if((dataProvider as ArrayCollection).getItemAt(rowIndex,0).status==1) 
                         color = 0xdf8b41; 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                     else if((dataProvider as ArrayCollection).getItemAt(rowIndex,0).status==2) 
                         color = 0xa9a79f; 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                         else if((dataProvider as ArrayCollection).getItemAt(rowIndex,0).status==3) 
                         color = 0x00ff00;
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                     else 
                         super.drawRowBackground(s,rowIndex,y,height,color,dataIndex); 
                catch(err:Error){
    it works very good but the problem is :
    when i scroll the datagrid vertically the rows don't update its color, i mean the the rows scrolled but the colors don't
    any help?
    thanx alot

    Ok, I'm back. Try this out:
    package
        import flash.display.Graphics;
        import flash.display.Shape;
        import flash.display.Sprite;
        import mx.controls.DataGrid;
        import mx.core.FlexShape;
        public class CustomDG extends DataGrid
            private var _strongColor:uint = 0x9BCE49;
            private var _fadedColor:uint = 0xC9FDC8;
            override protected function drawRowBackground(s:Sprite,
                                                          rowIndex:int,
                                                          y:Number,
                                                          height:Number,
                                                          color:uint,
                                                          dataIndex:int):void 
                var background:Shape;
                if (rowIndex < s.numChildren)
                    background = Shape(s.getChildAt(rowIndex));
                else
                    background = new FlexShape();
                    background.name = "background";
                    s.addChild(background);
                background.y = y;
                color == 0xFFFFFF ? color = _fadedColor : color = _strongColor;
                var graphics:Graphics = background.graphics;
                graphics.clear();
                graphics.beginFill(color);
                graphics.drawRect(0, 0, width, height);
                graphics.endFill();
    I don't really have time to play around with the alpha part and make it work with a single color that is once faded and once not. I chose to play around with 2 different colors ( a strong version and a light version ). Obviously, you can play around with the alpha too, you just need to understand the mechanism behind the updating.
    With best regards,
    Barna Biro
    Blog: http://blog.wisebisoft.com
    EDIT: I think that it's even better to use 2 different colors because this way, you have even more control over the appearance. You are not limited this way to a single color and it's faded version. You could combine 2 totally different colors ( like blue and red ).

  • Mx datagrid problem.

    Hi all,
         I am using flex 4.6's mx.datagrid. i applied some filter function to my datagrid. it works very good and fast. But when i sort the column and reapply my filter function, it doesn't work
    Any ideas?

    Hi,
         Thanks Alex.
         I resolved this problem. I loop throw dataprovider and update some properties of dataprovider before apply filterfunction. It works good when sort is not applied.
    while sorting is applied, and do the dataprovider updation, datagird dispatch 'collectionchange' event and apply sorting.
         For example when i update the property of 0th row, datagrid sorts the dataprovider. now 0th goes to 20th row 20 comes to the 0th index.
    Now i increment index to 1. But actually i missed 20th row which is now in 0th index.
         So i didn't get my expected result while filter my data. I resolved this problem by the following way.
        var ISortTemp:ISort; = this.dataProvider.sort;
        this.dataProvider.sort = null;
    for (var index:int = 0; index < dataProvider.length; index ++)
                                                                               dataProvider[index][dgdColumn.dataField].@sel = "0";
      this.dataProvider.sort = ISortTemp;
                                            this.dataProvider.filterFunction = FltDataProvider;
                                            this.dataProvider.refresh();

  • Rich:DataGrid Problem

    Hi guys,
    i have a problem with the rich:datagrid. The page which have the datagrid starts with a search method by name. ( query includes like function ) Search components are in h:form. So the related names after the search, will be ordered on the datagrid. Each row has 2 textbox and one a4j:commandButton. When the people arranged on the rows, the inputboxes filled with the values. The values are taken from the db. The problem is, for example grid has 2 rows, when i want to change the first row's values the change can not be applied, i write the values of inputboxes on the console and default values comes which are filled when the datagrid is set. But on the second row i can change the values.
    My managed bean scope is session. I opened a a4j:form inside the rich:datagrid, the components (two inputboxes and a4j:commandButton) are stored in this form.
    I m waiting your answers, thanks in advance.

    Thanks Balusc
    Thank you very much.
    I was geting this problem last 5 day now its resovled.
    Only few change in ur code like below code
    CityIDLookup[] city1 = (CityIDLookup[])cda.getCityList();
                   selectItems = new ArrayList<SelectItem>();
                   for (int i=0;i<city1.length;i++) {
                       selectItems.add(new SelectItem(city1.getName()));
                   System.out.println("i "+i+" name is "+selectItems.get(i));

  • Populate datagrid and draw linechart based on xmlList

    I am generating dynamic xml structure like this
    <root>
      <OPVector>
        <Distance>0</Distance>
        <Height1>100</Height1>
        <Height2>200</Height2>
        <Height3>300</Height3>
      </OPVector>
      <OPVector>
        <Distance>100</Distance>
        <Height1>200</Height1>
        <Height2>300</Height2>
        <Height3>400</Height3>
      </OPVector>
      <OPVector>
        <Distance>200</Distance>
        <Height1>300</Height1>
        <Height2>400</Height2>
        <Height3>500</Height3>
      </OPVector>
    </root>
    What i have to do is to populate data grid based on this xml structure and draw a line chart where distance is category axis (x-axis) and Height1, Height2 etc are line series . No of Height fields depends on how many height values are entered by user (in text field Height1, Height2, Height3, Height4, Height5,Height6).
    Given is the code of my application ....
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="905" height="482" creationComplete="init();">
    <mx:Script>
    <![CDATA[
    import mx.events.IndexChangedEvent;
    private var dataProvider:XMLList = new XMLList();
    private var initDist:int ;
    private var offset:int  ;
    private var finalDist:int;
    private var height1:int;
    private var height2:int;
    private var height3:int;
    private var height4:int;
    private var height5:int;
    private var height6:int;
    private var heat:int;
    private var dataOP:XMLList;
    public function init():void{
    initDist = parseInt(txtInitDist.text);
    offset = parseInt(txtOffset.text);
    finalDist = parseInt(txtFinalDist.text);
    height2 = parseInt(txtHeight1.text);
    height2 = parseInt(txtHeight2.text);
    height3 = parseInt(txtHeight3.text);
    height4 = parseInt(txtHeight4.text);
    height5 = parseInt(txtHeight5.text);
    height6 = parseInt(txtHeight6.text);
    heat = parseInt(txtHeat.text);
    public function getOP():void{
    dataOP = createXMLObject();
    currentState='stateOP';
    trace(dataOP.toXMLString());
    } // public function getOP():void{
    public function createXMLObject():XMLList{
    var data:XMLList = XMLList(<root></root>);
    for (var i:int=initDist;i<=finalDist;i+=offset){
    var x:XMLList = new XMLList(<OPVector></OPVector>);
    var distance:String = "<Distance>"+i+"</Distance>";
    var strHeight1:String = "<Height1>"+(parseInt(txtHeight1.text)+i)+"</Height1>";
    var strHeight2:String = "<Height2>"+(parseInt(txtHeight2.text)+i)+"</Height2>";
    var strHeight3:String = "<Height3>"+(parseInt(txtHeight3.text)+i)+"</Height3>";
    var strHeight4:String = "<Height4>"+(parseInt(txtHeight4.text)+i)+"</Height4>";
    var strHeight5:String = "<Height5>"+(parseInt(txtHeight5.text)+i)+"</Height5>";
    var strHeight6:String = "<Height6>"+(parseInt(txtHeight6.text)+i)+"</Height6>";
    x.appendChild(distance);
    if (txtHeight1.text != ""){
    x.appendChild(strHeight1);
    if (txtHeight2.text != ""){
    x.appendChild(strHeight2);
    if (txtHeight3.text != ""){
    x.appendChild(strHeight3);
    if (txtHeight4.text != ""){
    x.appendChild(strHeight4);
    if (txtHeight5.text != ""){
    x.appendChild(strHeight5);
    if (txtHeight6.text != ""){
    x.appendChild(strHeight6);
    data.appendChild(x);
    } // for (var i:int=initDist;i<finalDist;i+=offset){
    return data;
    } // public function createXMLObject():void
    ]]>
    </mx:Script>
    <!-- States Definition -->
    <mx:states>
    <mx:State name="stateOP">
    <mx:RemoveChild target="{btnOP}"/>
    <mx:RemoveChild target="{btnThermal}"/>
    <mx:RemoveChild target="{txtHeight5}"/>
    <mx:RemoveChild target="{txtHeight6}"/>
    <mx:RemoveChild target="{txtFinalDist}"/>
    <mx:RemoveChild target="{label1}"/>
    <mx:RemoveChild target="{label2}"/>
    <mx:RemoveChild target="{label3}"/>
    <mx:RemoveChild target="{txtHeight3}"/>
    <mx:RemoveChild target="{txtHeight4}"/>
    <mx:RemoveChild target="{txtOffset}"/>
    <mx:RemoveChild target="{label4}"/>
    <mx:RemoveChild target="{label5}"/>
    <mx:RemoveChild target="{label6}"/>
    <mx:RemoveChild target="{txtHeight1}"/>
    <mx:RemoveChild target="{txtHeight2}"/>
    <mx:RemoveChild target="{txtInitDist}"/>
    <mx:RemoveChild target="{label7}"/>
    <mx:RemoveChild target="{label8}"/>
    <mx:RemoveChild target="{label9}"/>
    <mx:RemoveChild target="{txtHeat}"/>
    <mx:RemoveChild target="{label13}"/>
    <mx:AddChild position="lastChild">
    <mx:DataGrid x="57" y="112" width="274" height="336" id="dgPressure" dataProvider="{dataOP}">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
    <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
    <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:LineChart x="382" y="112" id="lcOverPressure" width="513" height="182">
    <mx:series>
    <mx:LineSeries displayName="Series 1" yField=""/>
    </mx:series>
    </mx:LineChart>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Legend dataProvider="{lcOverPressure}" x="810" y="51"/>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Button x="382" y="426" label="Close" id="btnClose" click="currentState=''"/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="stateTR">
    <mx:RemoveChild target="{txtHeat}"/>
    <mx:RemoveChild target="{txtHeight1}"/>
    <mx:RemoveChild target="{txtHeight3}"/>
    <mx:RemoveChild target="{txtHeight5}"/>
    <mx:RemoveChild target="{txtHeight2}"/>
    <mx:RemoveChild target="{txtHeight4}"/>
    <mx:RemoveChild target="{txtHeight6}"/>
    <mx:RemoveChild target="{txtInitDist}"/>
    <mx:RemoveChild target="{txtOffset}"/>
    <mx:RemoveChild target="{txtFinalDist}"/>
    <mx:RemoveChild target="{label13}"/>
    <mx:RemoveChild target="{label7}"/>
    <mx:RemoveChild target="{label4}"/>
    <mx:RemoveChild target="{label3}"/>
    <mx:RemoveChild target="{label8}"/>
    <mx:RemoveChild target="{label5}"/>
    <mx:RemoveChild target="{label1}"/>
    <mx:RemoveChild target="{label9}"/>
    <mx:RemoveChild target="{label6}"/>
    <mx:RemoveChild target="{label2}"/>
    <mx:RemoveChild target="{btnOP}"/>
    <mx:RemoveChild target="{btnThermal}"/>
    <mx:AddChild position="lastChild">
    <mx:DataGrid x="39" y="108" width="301" height="364">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
    <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
    <mx:DataGridColumn headerText="Column 3" dataField="col3"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:LineChart x="420" y="108" id="linechart1" width="475" height="181">
    <mx:series>
    <mx:LineSeries displayName="Series 1" yField=""/>
    </mx:series>
    </mx:LineChart>
    </mx:AddChild>
    <mx:AddChild position="lastChild">
    <mx:Legend dataProvider="{linechart1}" x="810" y="13"/>
    </mx:AddChild>
    </mx:State>
    </mx:states>
    <!-- States Definition -->
    <!-- Controls Definition -->
    <mx:TextInput x="331" y="95" width="62" id="txtHeat" text="8"/>
    <mx:TextInput x="231" y="229" width="62" id="txtHeight1" text="100"/>
    <mx:TextInput x="231" y="259" width="62" id="txtHeight3" text="300"/>
    <mx:TextInput x="231" y="289" width="62" id="txtHeight5"/>
    <mx:TextInput x="357" y="229" width="62" id="txtHeight2" text="200"/>
    <mx:TextInput x="357" y="259" width="62" id="txtHeight4"/>
    <mx:TextInput x="357" y="289" width="62" id="txtHeight6"/>
    <mx:TextInput x="580" y="229" width="62" id="txtInitDist" text="0"/>
    <mx:TextInput x="580" y="259" width="62" id="txtOffset" text="100"/>
    <mx:TextInput x="580" y="289" width="62" id="txtFinalDist" text="2000"/>
    <mx:Label x="298" y="97" text="Heat" id="label13"/>
    <mx:Label x="168" y="231" text="Height1" id="label7"/>
    <mx:Label x="168" y="261" text="Height3" id="label4"/>
    <mx:Label x="168" y="291" text="Height5" id="label3"/>
    <mx:Label x="302.5" y="231" text="Height2" id="label8"/>
    <mx:Label x="301" y="261" text="Height4" id="label5"/>
    <mx:Label x="301" y="291" text="Height6" id="label1"/>
    <mx:Label x="484" y="231" text="Initial Distance" id="label9"/>
    <mx:Label x="533" y="261" text="Offset" id="label6"/>
    <mx:Label x="490" y="291" text="Final Distance" id="label2"/>
    <mx:Button x="298.5" y="384" label="Pressure Effects" id="btnOP" click="getOP()"/>
    <mx:Button x="464.5" y="384" label="Thermal Effects" width="142" id="btnThermal"/>
    <mx:Label x="298" y="10" text="Weather Effects" fontWeight="bold" fontSize="18"/>
    <!-- Controls Definition -->
    </mx:Application>

    I suggest that you first not try to cram all of your code into the MXML. Though many examples use this approach for quick copy-and-pasting, it is bad style and not as maintainable. You should use the code-behind approach where your MXML is strictly for layout of the view and its root element is a custom class that extendeds the usual base (in this case Application).
    Since the number of series in your line cart may vary, what you will need to do is dynamically create them whenever the data provider is updated.

  • Using xml with datagrid - problem with element attributes ...

    Hi,
    When i try to set the datafield in a DataGridColumn to an
    attribute, ex.: @isPermaLink - the value is not printet in the
    datagrid?
    My code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="feedRequest.send()" layout="absolute"
    backgroundGradientColors="[#808080, #c0c0c0]">
    <mx:HTTPService id="feedRequest" url="
    http://kristianthrane.dk/feed"
    useProxy="false" />
    <mx:Panel x="10" y="10" width="475"
    title="{feedRequest.lastResult.rss.channel.title}" id="panel1"
    height="531">
    <mx:DataGrid id="dgPosts" x="20" y="20" width="100%"
    dataProvider="{feedRequest.lastResult.rss.channel.item.guid}"
    height="100%">
    <mx:columns>
    <mx:DataGridColumn headerText="Lande"
    dataField="@isPermaLink" />
    </mx:columns>
    </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    I hope someone has a tip ....
    Best regards,
    Kristian Thrane

    Hi Kristian,
    I'm with some problems, a bit alike yours, but from what I've seen, I would recomend you to see type errors...does the atribute "isPermaLink" inside the "guid" tag, or "title" tag?
    My problem is the opposite of what you have... I can place tag attributes in a datagrid, but I can't put in the same Datagrid the tag value. But I have no choice since the feed comes from a public webservice.
    My feed is:
    <search ver="3.0">
    <loc id="BRXX1094" type="1">Aveiro, Brazil</loc>
    <loc id="POXX0006" type="1">Aveiro, Portugal</loc>
    </search>
    <mx:DataGrid x="10" y="53" width="365" id="dgLocation" dataProvider="{wSearch.lastResult.loc}" itemClick="callService(event);">
    <mx:columns>
           <mx:DataGridColumn headerText="Localidade" dataField="loc"/> //This doesn't work
           <mx:DataGridColumn headerText="Referência" dataField="@id"/> //This does
    </mx:columns>
    </mx:DataGrid>
    Hope it give you any ideas.
    Beste regards
    Leonel

  • Custom DataGrid problems with Comboboxes

    I am using a custom datagrid with comboboxes and
    colorpickers. I found this code on the web and adapted it to work
    with my code. The only problem is that if you pull down a combobox
    and then click somewhere outside without selecting anything, it
    seems to erase the data in the dataprovider arraycollection and so
    'value' in the set data method becomes null.

    This is not a bug if I understand you properly. I believe most people would wish anything which is obtained via the tv to be backed up, which is why the content is transferred. If you want it to remain available on the tv you will need to sync it back to it.

  • Flex datagrid problem - $20 reward

    My Datagrids don't seem to work as I would expect.
    The biggest issue is that resizing column seems to not be
    very intuitive, grabbing directly on the dividing line resizes the
    parent SizeableTitleWindow which may actually shrink the table with
    the window, if I grab to the side of the line, but still with the
    resize cursor, it seems to resize most of the time like expected,
    but i need it to work like expected for people without training
    them to grab to the side.
    It also seems that if I resize the parent SizeableTitleWindow
    and it forces the datagrid to shrink smaller than the datagrid
    'wants' to be it causes a white 'box' to hang out the side and
    bottom of the SizeableTitleWindow the size it wants to be, this
    also happens if I scroll the grid with my mousewheel without
    resizing, this looks bad whe I try to show my client what I have
    built.
    I will pay $10, via paypal, to the first person that provides
    a usable solution to each of these problems.

    Do to confidentiality I can't give the actual code/structure,
    so I created a simple recreation and in the process found the white
    box only happens when it has an itemrenderer in a column, but
    unfortunately it is needed that way so I still need a fix. I did a
    screen capture to demo both problems.
    demo:
    http://www.omnibizsolutions.com/DataGrid/DataGrid.html
    code:
    http://www.omnibizsolutions.com/DataGridCode.rar

  • More DataGrid Problems w/ custom CellRenderer

    Here's a program that creates a little data grid, populates it, and then tries to set the column one cell renderer to a very simple  custom CellRenderer derived class:
    import fl.controls.DataGrid;
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.controls.listClasses.CellRenderer;
    import fl.data.DataProvider;
    import RedTextCellRenderer;
    import com.kis_systems.utils.PicCellRenderer;
    var keys:Array = ["tname", "birthday", "pic_square"];
    var dpArray = [
    { tname:"Shakira", birthday:"May 24, 1978",
         pic:"pic_1_url" },
    { tname:"Alouitious Hornblower", birthday:"June 21, 1822",
         pic:"pic_2_url" },
    { tname:"Batman Robin", birthday:"January 4, 1951",
         pic:"pic_3_url" },
    { tname:"Franklin D. Roosevelt", birthday:"April 19, 1898",
         pic:"pic_4_url" },
    { tname:"Carol Hirunsipachoti", birthday:"December 25, 1973",
         pic:"pic_5_url" }
    var colWidths:Array = [200, 120, 60];
    var fpGrid:DataGrid = new DataGrid();
    fpGrid.editable = false;
    fpGrid.resizableColumns = false;
    fpGrid.showHeaders = false;
    fpGrid.rowHeight = 60;
    var gridWidth:uint = 0;
    fpGrid.columns = keys;
    fpGrid.dataProvider = new DataProvider(dpArray);
             // doc says I gotta do this *before* applying a new CellRenderer
    cvar col:DataGridColumn;
    col = fpGrid.getColumnAt(0);
    col.cellRenderer = new RedTextCellRenderer();
            // provide a new cell renderer for column 0...
    fpGrid.x = fpGrid.y = 15;
    gridWidth = 0;
    for (var lx:uint = 0; lx < 3; lx++)
         fpGrid.columns[lx].width = colWidths[lx];
         gridWidth += colWidths[lx];
    fpGrid.setSize(gridWidth, fpGridBgd.height - 30);
    addChild(fpGrid);
    And here is RedTextCellRenderer.as
    package
         import fl.controls.listClasses.CellRenderer;
         import flash.text.TextField;
         public class RedTextCellRenderer extends CellRenderer
              public function RedTextCellRenderer():void
                   textField.background = true;
                   textField.backgroundColor = 0xff8888;
    I've attached the resulting .swf
    In the first column, the one for which the custom cell is applied, it only draws the last cell.  The other columns get drawn fine.
    I'm working off the 'Setting styles for an individual column' example in the 'Customizing the DataGrid' section of the 'Flash AS3 Components Help' document for a guide.
    Among other glaring errors in the example code, seems to be this:
    var col3:DataGridCoumn = new DataGridColumn();
    col3 = aDg.getColumnAt(2);
    col3.cellRenderer = MultiLineCell;
    Isn't the col3 instance in the first line clobbered by the instance retrieved from the DataGrid 'aDg' in line 2?
    Anyway....  thoughts appreciated...
    rickb

    Hm.  No response.
    I'm getting a few thoughts about all of this:
    Flash AS3 appears to be a poor sister to Flex AS3, at least in the controls implementation - Adobe seems to be throwing all of their efforts into the Flex versions and leaving the Flash versions to dangle.
    'fl' DataGrid is buggy/arcane/subject to sequencing issues/all of the above.  Trying to follow even the basic examples to do something out of the ordinary seems to run into a rat's nest of issues, for which no-one seems to know the answers (evidenced by the multiple threads in this topic that appear to be unanswered on such things as resizing columns to content, or just putting a picture in a column.)
    Maybe I can use the 'mx' version...
    Or maybe I should just go over to Flex....
    rickb

  • On populate detail problem

    Dear members,
    (Forms 6i c/s)
    I have a master-details relation. When Forms fills the detail block with data, I'd like to fill a third block with data too, that means to change the query of this third block and execute it.
    To execute the query in the third block, I have to do a "go_block" and an "execute_query". I can't use "go_block" in a post-query trigger.
    - Is there a way to execute a query in a block without going to it ?
    - Beside "post-query", which triggers are fired when Forms puts data in a detail block ?
    - So can I use another trigger than post-query in my detail block, in which I could use "go_block" ?
    Thanks for you help.

    Well why NOT using the on-populate-details trigger for populating details???
    If you have a block with several detail blocks and change or add one relation, the trigger gets modified too...
    To avoid this, you could use the trigger on form level instead (and check at first if the right block is firing your trigger).

  • IOS Datagrid problem

    Hi!
    I could'nt find any solution and wanted to ask what is wrong with the datagrid on iphone.
    When i touch any datagrid item it moves around in mc.
    Current packager is Air 3.0 beta. IOS & Flash CS5.5.
    Thanks!

    Issue solved. Drag&amp;Drop function was effecting movieclips.
    Thanks!

  • Populate Datagrid from database

    Using Adobe Flex Builder 3 Beta 2, I have successfully used
    the Data Source Explorer window to connect to the Northwind and
    Pubs database on my SQL 2005 server. I can see the schemas and
    tables, etc. I understand that currently I cannot simply drag and
    drop the fields into the datagrid (which would be nice) so how do I
    'wire up' a table to the data grid? Is there an example which you
    can refer me to (with source) that would explain that? I've
    successfully wired up a webservice, but not to a database listed in
    the Data Source Explorer. If there were an example that showed a
    CRUD data grid, that would help.

    Just to give you an update as to where I am and where I'm
    hung up, I was able to make a little bit of progress but not too
    far.
    1. I created a Flex Project (Web application) and specify
    Applcation Server Type: ASP.net.
    2. Next, I have the choice of specifying 'Use ASP .NET
    Development Server' or 'Use Internet Information Services (IIS). At
    the 'Usa ASP .NET Development Server', the error message at the top
    of this wizard window says (X) You don't have ASP .NET Development
    Server Installed. [Well, it may not be running but I do have it
    installed as part of the .NET 2.0 Framework.. it does exist]. So,
    because of the error, I have no choice but to use the alternate
    option, 'Use Internet Information Services (IIS).
    3. I specify my Web Application Root: d:\Flex3
    Projects\TestProj3 (I manually have to create the folder).
    4. I speciy my Web Application URL:
    http://localhost
    5. I click the Finish button.
    Note... I've already selected my Connectivity using the Data
    Source Explorer (which is available by selecting the following in
    Flex Builder: Windows, Otherviews, Connectivity, Data Source
    Explorer, and then adding in a database connection at my MS SQL
    2005 server, specifying username and password).
    6. Next, from Flex Builder, I select: Data, Create
    Application from Database, and specify the current project,
    connection (in my case, Northwind) and the employee table, etc. I
    click NEXT.
    7. I can select C# with web services or Visual Basic with Web
    Services, so I select Visual Basic.
    8. Select Finish.
    OK at this point, a lot of code (action script, webservices,
    etc. is auto-generated for me - kewl.. just like Dreamweaver :-)
    Now I'm ready to run the application.
    But wait - I know it won't run because I note that the ASP
    .NET Development Server is not running. However - I can start it
    from the windows command line.
    First thing I do is stop my local IIS server which is using
    Port 80.
    Next thing I do is open a windows command line and navigate
    to my .Net 2.0 Framework directory:
    cd \WINDOWS\Microsoft.NET\Framework\v2.0.50727
    and then I run the ASP .NET Web server at the same path that
    my application (above) is written to (again, typed in the command
    line window).
    start /b webdev.webserver /port:80 /path:"D:\Flex3
    Projects\TestProj3\bin"
    Finally, from the Flex Builder window, I right-click on the
    auto-build Employee.mxml table and select 'Run application'.
    After a few moments an Internet Explorer window comes up. I
    believe it says:
    http://localhost/bin/Employees.html
    and I change it to read:
    http://localhost/Employees.html
    and it runs.. well it runs, but with 'An unexpected error
    occured and it has been logged.'
    So that's as far as I have gotten but it does write the code.
    So am I to assume that whether I do this by hand or use the
    'auto-generated code' that I will be using WebServices to read and
    write from the MS SQL 2005 database?
    I would much rather my Flex Application open a connection to
    the database directly and send SQL statements. I'm guessing that
    might not be possible without some driver? Perhaps thats were Adobe
    Live Cycle comes in?
    Any insight (frm anyone) would be helpful. Thank you.

  • DataGrid problem - code

    Hi,
    This does not work, any help appreciated. The function
    returns true and if I break within the function the array has the
    required data.
    Thanks,
    Paul

    Oops, should have been posted in the ActionScript forum -
    sorry.
    Paul

Maybe you are looking for