您的位置:首页 > 其它

flex学习笔记之5 DataGrid

2012-04-16 09:50 387 查看
首先定义xmllist,这个类似xml,相当于定义的节点,运用mx

<mx:XMLList id="employees">

<employee>//可自定义节点

<name>A</name>

<phone>123</phone>

<email>A@qq.com</email>

<active>true</active>//是否活动

</employee>

<employee>

<name>B</name>

<phone>123</phone>

<email>B@qq.com</email>

<active>true</active>

</employee>

<employee>

<name>C</name>

<phone>123</phone>

<email>C@qq.com</email>

<active>false</active>

</employee>

<employee>

<name>D</name>

<phone>555</phone>

<email>D@qq.com</email>

<active>true</active>

</employee>

</mx:XMLList> //定义节点的xml放在和DateGrid控件相同的根下,不需要放在事件处理中

<mx:DataGrid x="77" y="-3" dataProvider="{employees}">//绑定数据源

<mx:columns>添加列,有多少个子节点,添加相应的列

<mx:DataGridColumn dataField="name" headerText="Name"/>

<mx:DataGridColumn dataField="phone" headerText="Phone"/>

<mx:DataGridColumn dataField="email" headerText="Email"/>

</mx:columns>

</mx:DataGrid>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: