zoukankan      html  css  js  c++  java
  • <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()">

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()">

    http://www.manfridayconsulting.it/index.php?option=com_content&view=article&id=42:datagrid-binded-to-httpservice&catid=12:flex-3&Itemid=27

    DataGrid binded to HTTPService
    Lunedì 26 Gennaio 2009 20:23
    How to consume an HTTPService using Xml Object. You can see the power of Databinding in this environment.
    You only need to set the property dataProvider="{productsarray}" of the DataGrid to get all objects coming from
    on results function.
     
    Here an example of Xml object definition 
    <dataroot>
    <product>
    <id>1</id>
    <total>2</total>
    <name>Motherboard</name>
    <price>100</price>
    </product>
    <product>
    <id>2</id>
    <total>2</total>
    <name>Pprocessor</name>
    <price>150</price>
    </product>

    </dataroot>

     
    Now we start with the sample application:  
     
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="initApp()">
    <mx:HTTPService id="srv" url="services/products.xml"
    resultFormat="object"
    result="onResult(event)"/>
    <mx:DataGrid id="grid"
    width="100%"
    height="100%"
    dataProvider="{productsarray}">
    <mx:columns>
    <mx:DataGridColumn headerText="Total No."
    dataField="total"/>
    <mx:DataGridColumn headerText="Name"
    dataField="name"/>
    <mx:DataGridColumn headerText="Price"
    dataField="price"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var productsarray:ArrayCollection;
    private function initApp():void {
    this.srv.send();
    }
    private function onResult(evt:ResultEvent):void {
    this.productsarray = evt.result.data.product;
    }
    ]]>
    </mx:Script>
    </mx:Application>

  • 相关阅读:
    JS判断对象中是否存在某参数
    JS通过url下载文件
    .NET CORE LinQ查询中计算时间差
    C# 判断某个时间是星期几
    C#数组去重
    python Tank
    kubeflannel.yml Tank
    片言只语 Tank
    other Tank
    ERROR大集合 Tank
  • 原文地址:https://www.cnblogs.com/cy163/p/1514286.html
Copyright © 2011-2022 走看看