OK, I think I see what your problem is. You said that your PHP script returns
this, which is a nested array.
(Array)#0
[0] (Object)#1
BIRTH_DATE = "1985-01-01"
EMAIL = "[EMAIL PROTECTED]"
FIRSTNAME = "as"
HOUSENO = "40"
PHONE = ""
PHONENO = "1240235402-9"
POSTCODE = "sdf"
STREET = "asf"
STUDENTNO = "41"
SURNAME = "ap"
TOWN = "sdf"
It's obvious now that you need to add the first item (which is at the index of
zero), instead of the entire array, to the dataProvider. See the result[0]
below. Hope that makes sense. And just use addItem instead of addItemAt if you
just want to place it at the end of the array.
public function sendResultHandler(evt:ResultEvent):void
{
var row:Array = ArrayUtil.toArray(evt.result[0]);
dataProvider.addItem(row);
dataProvider.refresh();
}
Now you might have to change this line:
var row:Array = ArrayUtil.toArray(evt.result[0]);
to fit exactly what you want. It might work as is though.
Cheers,
Adam
----- Original Message -----
From: munene_uk
To: [email protected]
Sent: Monday, February 12, 2007 8:41 AM
Subject: [flexcoders] Re: Datagrid update woes(blank rows)
ive done as suggested however i still get a blank row
public function sendResultHandler(evt2:ResultEvent):void
{
var index:int = dg.dataProvider.length;
dg.dataProvider.addItemAt(evt2.result,index);
trace(ObjectUtil.toString(evt2.result) );
& nbsp; dg.dataProvider.refresh();
}
funny thing is that if i do this
public function sendResultHandler(evt2:ResultEvent):void
{
dg. dataProvider = new ArrayCollection (
ArrayUtil.toArray(evt2.result) );
var index:int = dg.dataProvider.length;
dg.dataProvider.addItemAt(evt2.result,index);
trace(ObjectUtil.toString(evt2.result) );
dg.dataProvider.refresh();
}
it correctly populates the datagrid with the correct record so im assuming
that the data being retrieved is correct, so the problem must be the
addItemAt() . im really taking a stab in the dark here but i really appreciate
the help you've given so far.....