-
dynamic XMLList
I'm trying to dynamically create the sample below:
Code:
<mx:XMLList id="employees">
<employee>
<name>Christina Coenraets</name>
<phone>555-219-2270</phone>
<email>[email protected]</email>
<active>true</active>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555-219-2012</phone>
<email>[email protected]</email>
<active>true</active>
</employee>
</mx:XMLList>
I have this tag in my mxml:
<mx:XMLList id="results">
</mx:XMLList>
For some reason, Flex will not allow you to use .appendChild() unless there is already one tag. That means I'd have to do this:
<mx:XMLList id="results">
<resultList>
</resultList>
</mx:XMLList>
to get it to work which means I'd end up with something like this:
Code:
<mx:XMLList id="employees">
<resultList>//I dont want one big wrapping tag
<employee>
<name>Christina Coenraets</name>
<phone>555-219-2270</phone>
<email>[email protected]</email>
<active>true</active>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555-219-2012</phone>
<email>[email protected]</email>
<active>true</active>
</employee>
</resultList>
</mx:XMLList>
Atm, I'm taking a delimited string sent from PHP. I'm using .split() and a for loop to create a multidimensional array that I intend on populating the XMLList with. (ie. results.row[i] = myArray[i][0]; )
Am I way off on this?
-
Holy carp, I am way over complicating this. Kinda hating flex right now, if I didnt need the built in sorting ability of the datagrid, I'd have knocked this out in flash 8 in about 20 minutes.
Anyway, found this great article (thanks to gSOLO) for connecting with PHP.
http://www.adobe.com/devnet/flex/art...x2_php_03.html