This content has been marked as final. Show 4 replies
Create a [Bindable] instance(global) var typed as XML, and bind the DG to that.
[Bindable]private var _xmlSelected:XML
In your TextInput change handler, use the the .text value in an e4x expression aginst the XML data:
private function onChange(event:Event):void
var sText:String = event.target.text;
_xmlSelected = myXML.person.(id==sText)[ 0 ]; //[ 0 ]because e4x expressins always return an XMLList, and you want a node.
That should do it.
Also, DataGrid might not make sense for this use. Why use it with only a single row's worth of data?
Thanks for the reply but after sitting on it for like 3 hours yesterday i managed to solve it in a diffrent way ;)
What i did was creating a datagrid and datagrid columns and giving the columns the datafield of the XML nodes without giving the datagrid itself the arraycollection as a dataprovider.
Then when the user type the id in the text input box and the loop find the current nod it send it to the datagrid as dataprovider.
For example if my array collection is called AC i set grid.dataprovider=AC (where i is the loop counter).
Then some CSS styles to the whole app and it really looks and works great now
Sure. If you use e4x xml, you can skip the conversion to ArrayCollection. It is a matter of taste, mostly.