SharePoint List to Datagrid in Flex

The following example will show you how you can use a Button control as a custom item renderer in a DataGrid in Flex.
The XMLListCollection class provides collection functionality to an XMLList object and makes available some of the methods of the native XMLList class.

Refer article Access SharePoint List in Flex to understand how the List can be read in Flex.

XML Screenshot


<?xml version=”1.0″?>
<mx:Application xmlns:mx=”” layout=”absolute”  initialize=”onCreate(event);” >
import mx.controls.Alert
import mx.collections.XMLListCollection;
import mx.collections.ArrayCollection;
private function onCreate(e:Event):void
var XMLLoader:URLLoader= new URLLoader(new URLRequest(“[server]/_vti_bin/owssvr.dll?Cmd=Display&List={311A4A47-E6B4-49FA-916C-900A698E1188}&XMLDATA=TRUE”))  //Replace Server with your sharePoint link
function openXMLValues(e:Event):void
{ var XMLL:XMLList=new XMLList(
var rsNS:Namespace = XMLL.namespace(“rs”);
var zNS:Namespace = XMLL.namespace(“z”);
var sNS:Namespace = XMLL.namespace(“s”);
var Values:XMLListCollection=new XMLListCollection(XMLL.rsNS::data.zNS::row);
<mx:DataGrid x=”21″ y=”25″ width=”596″ height=”220″ id=”DG” >
<mx:DataGridColumn dataField=”@ows_LinkFilename” />
<mx:DataGridColumn itemRenderer=”{ButtonRen}” /> </mx:columns>
</mx:DataGrid><mx:Component id=”ButtonRen”>
<mx:Button label=”Generate”  > </mx:Button>
To Define Component to be called in itemRenderer property

<mx:Component id=”ButtonRen”>
<mx:Button label=”Generate”  > </mx:Button>