因此,在 Flex 移动项目中,我试图将 Select SQLLite 查询的结果绑定到视图。但它没有显示结果,我得到以下
warning: unable to bind to property 'myData' on class 'com.amec.controls.Text::TextListView'
来自闪存生成器。下面是我的视图类。我错过了什么或做错了什么?
<?xml version="1.0" encoding="utf-8"?>
<amec:BaseAddView xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:amec="com.amec.Components.*"
creationComplete="vw_creationCompleteHandler(event)" title="TextListView">
<amec:layout>
<s:VerticalLayout horizontalAlign="center" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5"/>
</amec:layout>
<fx:Script>
<![CDATA[
import com.amec.BaseSql;
import com.amec.MenuMessage;
import mx.events.FlexEvent;
[Bindable]private var resultArr:ArrayCollection = new ArrayCollection();
import mx.collections.ArrayCollection;
protected function vw_creationCompleteHandler(event:FlexEvent):void
{
}
private function get myData():ArrayCollection
{
var conn:BaseSql = new BaseSql();
conn.stmt.text = "SELECT DMV_VALUE_1 FROM DOMAIN_VALUE WHERE DMV_DMN_ID = :id";
x.parameters[":id"] = id;
x.sqlConnection = conn.stmt.sqlConnection;
var x:SQLStatement = new SQLStatement;
x.text = conn.stmt.text;
x.execute();
var result:Array = conn.stmt.getResult().data;
var r:ArrayCollection = new ArrayCollection();
if (result)
{
r.source = result;
return r;
} else {
return null;
}
}
]]>
</fx:Script>
<s:List id="list" top="0" bottom="0" left="0" right="0"
dataProvider="{myData}" labelField="DMV_VALUE_1">
</s:List>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
此外,我没有得到任何结果显示在视图中。