2 Replies Latest reply on Mar 25, 2009 7:12 AM by Gregory Lafrance

    Populate data grid

      hi i need to populate the data grid in mxml.
      For that i need to call jsp from flex to get data.
        • 1. Re: Populate data grid
          alice_data Level 1

          There is an easy to read document at http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html, and even though it is about PHP, you could use the url as JSP.


          • 2. Re: Populate data grid
            Gregory Lafrance Level 6
            This code may help once you get your data back. It accesses a data file but many of the principles are the same.

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
            import mx.events.ListEvent;
            import mx.collections.XMLListCollection;
            import mx.rpc.events.ResultEvent;

            [Bindable] private var dataxlc:XMLListCollection = new XMLListCollection();

            private function resultHandler(e:ResultEvent):void {
            var xmllist:XMLList = new XMLList(e.result..product);
            dataxlc = new XMLListCollection(xmllist);
            <mx:HTTPService id="dataRequest" useProxy="false" resultFormat="e4x"
            result="resultHandler(event)" url="data3.xml"/>
            <mx:DataGrid dataProvider="{dataxlc}" rowCount="{dataxlc.length}">
            <mx:DataGridColumn dataField="@partnum"
            headerText="Part Number"/>
            <mx:DataGridColumn dataField="name"
            headerText="Product Name"/>
            ------------------------------- data3.xml -----------------------------------
            <?xml version="1.0" encoding="utf-8"?>
            <product partnum="001">
            <product partnum="002">
            <product partnum="003">
            <product partnum="004">
            <product partnum="005">
            <product partnum="006">
            <product partnum="007">