Hi, I want the XMLList obtained after filtering to act as dataprovider to my datagrid...
Can some1 help me plz?? This is my 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.controls.Alert; [Bindable] public var myList:XML=new XML(); public var fil:XMLList = new XMLList(); public var input:XML= <head> <story main="Most Popular"> <sub>Most Popular</sub> <rating>2</rating> <desc>Solo journey to the north pole</desc> <img>images/one.jpg</img> <link></link> <code>1</code> </story> <story main="Most Popular"> <sub>Ambition</sub> <rating>1</rating> <desc>only time will tell</desc> <img>images/two.jpg</img> <link></link> <code>1</code> </story> <story main="Most Popular"> <sub>Lifestyle</sub> <rating>3</rating> <desc>any thing can do</desc> <img>images/three.jpg</img> <link></link> <code>1</code> </story> <story main="Ambitions"> <sub>Ambition</sub> <rating>4</rating> <desc>Family time story</desc> <img>images/four.jpg</img> <link></link> <code>1</code> </story> </head>; private function addUniqueValue(value:Object, list:XMLList):XMLList { if(!list.contains(value)) { list += value; } return list; } public function init():void { var x:XMLList = input.story.(@main == "Most Popular").sub; for(var i=0;i < x.length();i++) { Alert.show(x[i]); } input.descendants().(fil = addUniqueValue (attribute("main"), fil)); myList.appendChild(fil);/*i want to add 'fil' to datagrid as dataprovider*/ } ]]> </mx:Script> <mx:HBox height="40%"> <mx:DataGrid id="source" dataProvider="{myList}" width="100%" rowCount="5" height="152" paddingLeft="0" paddingBottom="0" paddingRight="0" paddingTop="0" wordWrap="true" rowHeight="30" fontSize="12" showHeaders="false" backgroundColor="#003399" selectionColor="#578693" horizontalGridLines="true" horizontalGridLineColor="#7a7d7d" horizontalScrollPolicy="off" verticalScrollPolicy="off" fontFamily="Arial" verticalGridLines="false"> <mx:columns> <mx:DataGridColumn dataField="main" textAlign="left"/> <mx:DataGridColumn dataField="rating" textAlign="right"/> </mx:columns> </mx:DataGrid> </mx:HBox> </mx:Application> Thanx, sam

