Apache flex 设置数据提供程序
我有一个像这样的php服务Apache flex 设置数据提供程序,apache-flex,Apache Flex,我有一个像这样的php服务 <stockproductservice:StockproductService id="stockproductService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
<stockproductservice:StockproductService id="stockproductService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
它使用php服务
如何在ItemRedener中设置数据提供程序
<s:DataService source="{stockproductService.getAllStockproduct1()}"/>
及
不起作用。如果您的问题是如何设置Web服务以最简单的形式填充数据提供程序,则可能是:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" creationComplete="creationCompleteHandler(event)"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:List dataProvider="{restaurants}" labelField="name" />
<fx:Declarations>
<s:WebService id="RestaurantWS" wsdl="http://examples.adobe.com/flex3app/restaurant_ws/RestaurantWS.xml?wsdl" />
<s:CallResponder id="getRestaurantsResult"
result="restaurants = getRestaurantsResult.lastResult as ArrayCollection"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable]
public var restaurants:ArrayCollection;
protected function creationCompleteHandler(event:FlexEvent):void
{
getRestaurantsResult.token = RestaurantWS.getRestaurants();
}
]]>
</fx:Script>
</s:Application>
itemRenderer没有数据提供程序。它通常是具有数据提供程序的基于列表的组件的一部分,例如,具有作为数据提供程序的ArrayCollection的列表。ItemRenderer是呈现列表中的项的组件,它具有从ArrayCollection接收对象的prop:public函数集数据(value:Object){…}。DataService负责从服务器获取数据,例如创建ArrayCollection。您应该以不同的方式陈述您的问题。那么,如何使用php服务设置数据提供者呢?看起来,php服务的结果不是数组集合。我已经想好了如何创建item Redener。只需像这样使用Data.XXXX就可以填充php服务的结果。无论如何,谢谢你的例子
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" creationComplete="creationCompleteHandler(event)"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:List dataProvider="{restaurants}" labelField="name" />
<fx:Declarations>
<s:WebService id="RestaurantWS" wsdl="http://examples.adobe.com/flex3app/restaurant_ws/RestaurantWS.xml?wsdl" />
<s:CallResponder id="getRestaurantsResult"
result="restaurants = getRestaurantsResult.lastResult as ArrayCollection"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable]
public var restaurants:ArrayCollection;
protected function creationCompleteHandler(event:FlexEvent):void
{
getRestaurantsResult.token = RestaurantWS.getRestaurants();
}
]]>
</fx:Script>
</s:Application>