Php Flex中列的数据 私有函数getUs(数据:对象):void{ var应用程序:ArrayCollection=新的ArrayCollection(data.result); dg.dataProvider=应用程序; }
我得到的值是ArrayCollection,但当我将其绑定到Datagrid时,我没有得到任何值。。。。虽然从PHP返回的对象很好。您尝试过调试吗?我建议在设置var appSes之后立即运行带有断点的调试,并检查该变量,以确保使用e服务结果数据正确创建ArrayCollection 如果正确创建了ArrayCollection,接下来请确保Php Flex中列的数据 私有函数getUs(数据:对象):void{ var应用程序:ArrayCollection=新的ArrayCollection(data.result); dg.dataProvider=应用程序; },php,apache-flex,Php,Apache Flex,我得到的值是ArrayCollection,但当我将其绑定到Datagrid时,我没有得到任何值。。。。虽然从PHP返回的对象很好。您尝试过调试吗?我建议在设置var appSes之后立即运行带有断点的调试,并检查该变量,以确保使用e服务结果数据正确创建ArrayCollection 如果正确创建了ArrayCollection,接下来请确保数据字段名称与ArrayCollection中的数据正确匹配-这些名称区分大小写。尝试从DataGrid中删除所有列。如果您的ArrayCollection
数据字段
名称与ArrayCollection中的数据正确匹配-这些名称区分大小写。尝试从DataGrid中删除所有列。如果您的ArrayCollection有效,DataGrid将自动创建列,其中ArrayCollection中的数据字段名称作为列标题:
<local:CheckBoxDataGrid id="dg"
allowMultipleSelection="true" x="118" y="151" width="557">
<local:columns>
<mx:DataGridColumn dataField="firstName" headerText="Select" width="50" sortable="false" itemRenderer="CheckBoxRenderer" >
</mx:DataGridColumn>
<mx:DataGridColumn id="userID" headerText="User ID" />
<mx:DataGridColumn dataField="userlevel" editable="true" headerText="Role" />
<mx:DataGridColumn id="email" headerText="Email" />
</local:columns>
</local:CheckBoxDataGrid>
private function getUs(data:Object):void{
var appSes:ArrayCollection = new ArrayCollection(data.result);
dg.dataProvider = appSes;
}
希望有帮助 我的第一个建议是在不通过PHP加载东西的情况下测试它。将数据复制到本地ArrayCollection,并基于此进行分配 您还可能希望初始化dataprovider属性(尽管事实上它不应该初始化,但有时会有所帮助): 如果有帮助,请告诉我
ArrayCollection:
{firstName: "Joe", userID: 1, userlevel: 3, email: "joe@foo.com"},
{firstName: "Mary", userID: 2, userlevel: 4, email: "mary@foo.com"},
{firstName: "Bob", userID: 3, userlevel: 2, email: "bob@foo.com"}
Will display as the following if you do not specify columns:
firstName userId userLevel email
------------------- ------------- ------------ ----------------------------
Joe 1 3 joe@foo.com
Mary 2 4 mary@foo.com
Bob 3 2 bob@foo.com
<local:CheckBoxDataGrid id="dg" dataProvider="{ myArrayCollection }"
[Bindable]
private var myArrayCollection:ArrayCollection
private function getUs(data:Object):void
{
myArrayCollection = new ArrayCollection(data.result);
trace( myArrayCollection ); // Just a sanity check.