Apache flex Flex:使用'访问SQLite条目;getItemAt()';
我用Apache flex Flex:使用'访问SQLite条目;getItemAt()';,apache-flex,sqlite,Apache Flex,Sqlite,我用SQLite数据库中的输入填充了一个数组。当我使用此数组作为s:列表的数据提供程序时,它将显示我指定的数组中的所有对象。 我想访问数组中的一些对象,并且一直在尝试使用getItemAt()。目前,我可以返回数组中的第一个对象,但是更改索引(例如,将其更改为getItemAt(1)),它将不返回任何内容 最终,我的目标是用在应用程序其他地方输入的数据填充一个FX:Model,并将其插入到SQLite数据库中。然后,该模型充当饼图的数据提供者。我可以将数据库的第一个条目传递到模型/饼图,但不能访
SQLite
数据库中的输入填充了一个数组。当我使用此数组作为s:列表的数据提供程序时,它将显示我指定的数组中的所有对象。我想访问数组中的一些对象,并且一直在尝试使用
getItemAt()
。目前,我可以返回数组中的第一个对象,但是更改索引(例如,将其更改为getItemAt(1)
),它将不返回任何内容
最终,我的目标是用在应用程序其他地方输入的数据填充一个FX:Model,并将其插入到SQLite
数据库中。然后,该模型充当饼图的数据提供者。我可以将数据库的第一个条目传递到模型/饼图,但不能访问其他条目
代码的一些相关部分如下所示。故障排除技巧将不胜感激
[Bindable]
private var GHGsource:ArrayCollection;
然后:
GHGsource = new ArrayCollection();
}
for each ( var o:Object in event.data )
{
GHGsource.addItem(o);
}
FullList.dataProvider = GHGsource;
}
}
模型设置:
<fx:Declarations>
<fx:Model id="GHG" >
<data>
<row>
<input>Enteric methane</input>
<Value> {GHGsource.getItemAt(0).answer} </Value>
肠道甲烷
{GHGsource.getItemAt(0.answer}
列表设置:
<s:List id="FullList">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer labelFunction="returnQuestion" messageFunction="returnAnswer">
<fx:Script>
<![CDATA[
private function returnQuestion(item:Object):String
{
return "Question: " + item.question;
}
private function returnAnswer(item:Object):String
{
var response:String = "";
if ( !item.answer || item.answer == "" )
{
response = "(no response)";
} else {
response = item.answer;
}
return response;
}
]]>
</fx:Script>
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
此应用程序基于中列出的数据库结构
也许深入了解s:List组件如何访问数组中的对象会有所帮助
其他细节:
在调试模式下运行时,对象似乎没有正确绑定到arraycollection。
警告:无法绑定到类“Object”(类不是IEventDispatcher)上的属性“xxx”)
我尝试了以下链接上的指南,但没有成功。好的,明白了
GHGsource = new ArrayCollection();
}
for each ( var o:Object in event.data )
{
GHGsource.addItem(o);
}
FullList.dataProvider = GHGsource;
}
}
变成:
[Bindable]
private var passingArray:Array;
以及:
那么这就行了:
<fx:Declarations>
<fx:Model id="GHG" >
<data>
<row>
<input>Enteric methane</input>
<Value> {GHGsource.getItemAt(3).answer} </Value>
肠道甲烷
{GHGsource.getItemAt(3.answer}
<fx:Declarations>
<fx:Model id="GHG" >
<data>
<row>
<input>Enteric methane</input>
<Value> {GHGsource.getItemAt(3).answer} </Value>