Flex数据处理与渲染全解析
1. 数据渲染基础
在数据驱动的组件中,如List、ComboBox、DropDownList、Tree、DataGrid和AdvancedDataGrid等,可使用项目渲染器(item renderers)来控制数据的显示方式。与标签函数(labelFunction)只能自定义显示信息不同,项目渲染器更像是一个模板,能显示字符串以外的内容。
1.1 示例数据
以书籍列表为例,定义一个包含书籍信息的ArrayList:
private var myBooks:ArrayList = new ArrayList([
{title: 'PHP 6 and MySQL 5 for Dynamic Web Sites', year: 2008, image: './assets/php6mysql5.png'},
{title: 'Adobe AIR with Ajax', year: 2008, image: './assets/air.png'},
{title: 'Ruby', year: 2009, image: './assets/ruby.png'}
]);
1.2 简单显示标题
使用List组件简单显示每本书的标题:
<s:List dataProvider="{myBooks}" labelField="title" />
超级会员免费看
订阅专栏 解锁全文
1453

被折叠的 条评论
为什么被折叠?



