Hi all,
I’m stuck on this for over two days and cant find an answer.
I’m trying to create a datagrid using an arraycollection as the dataprovider.
The collection holds Guest objects.
The data grid recognizes the data but nothing is showen.
can please someone help, I dont know whats wrong.
thers the code:
<?xml version=“1.0” encoding=“utf-8”?>
<mx:Application xmlns:mx=“http://www.adobe.com/2006/mxml” layout=“absolute” creationComplete=“init()”>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import Data.Guest;
[Bindable]
private var guestsA:ArrayCollection;
private function init():void
{
guestsA = new ArrayCollection();
guestsA.addItem(new Guest("baba",3,"bride","father","family"));
guestsA.addItem(new Guest("gala",3,"groom","father","family"));
guestsA.addItem(new Guest("shala",3,"groom","mother","friend"));
guestsA.addItem(new Guest("fala",3,"groom","father","family"));
//guestsA.addItem({title: ADD_TASK});
}
]]>
</mx:Script>
<mx:DataGrid id="myDG" width="100%" height="100%" dataProvider="{this.guestsA}">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name"/>
<mx:DataGridColumn headerText="Number of poeple" dataField="numOfPeople"/>
<mx:DataGridColumn headerText="Side" dataField="side"/>
<mx:DataGridColumn headerText="Inner Side" dataField="innerSide"/>
<mx:DataGridColumn headerText="Category" dataField="category"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
and the Guest object:
package Data
{
[RemoteClass]
public class Guest
{
//Class Veriables
private var name:String;
private var numOfPeople:int;
private var side:String;
private var innerSide:String;
private var category:String;
private var tableNum:int;
private var apArrivel:Boolean;
public function Guest(name:String, numOfPeople:int, side:String, iSide:String, category:String)
{
this.SetName(name);
this.SetNumOfPeople(numOfPeople);
this.SetSide(side);
this.SetInnerSide(iSide);
this.SetCategory(category);
//this.SetTableNum(tableNum);
//this.apArrivel = apAr;
}
public function toString():String
{
return this.name + " " + this.numOfPeople + " " + this.side + " " + this.innerSide
+ " " + this.category;
}