<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
private function concatenateName(item:Object):String
{
return item.firstName + " "+item.lastName;
} ]]>
</fx:Script> <s:ButtonBar id="buttonBar" labelFunction="concatenateName">
<mx:ArrayCollection>
<fx:Object firstName ="马" lastName="楠" email="tahmed@flexinaction.com" phone="18815654512" />
<fx:Object firstName ="张" lastName="士鑫" email="zhangshixin@xiangm" phone="188156545103" />
<fx:Object firstName ="马" lastName="楠" email="tahmed@flexinaction.com" phone="18815654512" />
<fx:Object firstName ="张" lastName="士鑫" email="zhangshixin@xiangm" phone="188156545103" />
<fx:Object firstName ="马" lastName="楠" email="tahmed@flexinaction.com" phone="18815654512" />
</mx:ArrayCollection>
</s:ButtonBar>
</s:Application>

2使用多列标签函数

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.dataGridClasses.DataGridColumn;
[Bindable]
public var myAC:ArrayCollection = new ArrayCollection([
{name:"马楠", username:"manan",dtJoined:"01/02/2008 12:22:11",dtLogin:"02/20/2010 13:33:11"},
{name:"白小羽", username:"baixiaoyu",dtJoined:"01/02/2008 12:22:11",dtLogin:"02/20/2010 13:33:11"},
{name:"马a", username:"manan",dtJoined:"01/02/2008 12:22:11",dtLogin:"02/20/2010 13:33:11"},
{name:"马b", username:"manan",dtJoined:"01/02/2008 12:22:11",dtLogin:"02/20/2010 13:33:11"},
{name:"马c", username:"manan",dtJoined:"01/02/2008 12:22:11",dtLogin:"02/20/2010 13:33:11"}
]); public function formatDate(row:Object, col:DataGridColumn):String
{
var retVal:String ="";
if(col.dataField =="dtJoined") retVal = dFmt.format(row.dtJoined);
else if (col.dataField =="dtLogin")
retVal = dFmt.format(row.dtLogin);
return retVal;
} ]]>
</fx:Script>
<fx:Declarations>
<mx:DateFormatter id="dFmt" formatString="MM/DD/YY"/>
</fx:Declarations>
<mx:DataGrid id="dg" width="500" height="100" dataProvider="{myAC}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn dataField="username" headerText="Username"/>
<mx:DataGridColumn dataField="dtJoined" headerText="Joined" labelFunction="formatDate"/>
<mx:DataGridColumn dataField="dtLogin" headerText="Last login" labelFunction="formatDate"/>
</mx:columns>
</mx:DataGrid> </s:Application>

最新文章

  1. 【开源】玩的就是开源 - DevFw
  2. word2vec
  3. od破解实例
  4. JavaScript根据CSS的Media Queries来判断浏览设备的方法
  5. 【面试题001-补充】C++ MyString类的封装
  6. JavaScript网站设计实践(五)编写photos.html页面,实现点击缩略图显示大图的效果
  7. 数据库————Select 查询
  8. Caliburn Micro框架
  9. 在html中使用javascript
  10. 六、Spring Boot Controller使用
  11. Hibernate对应关系(了解)
  12. tyflow birth节点
  13. Apktool(3)——Apktool的使用
  14. iOS学习笔记之Reachability简单使用
  15. MySQL查询字符串长度最长的记录
  16. 20170706wdVBA正则表达式提取题目
  17. 针对TCP连接异常断开的分析
  18. BZOJ 2226 【SPOJ 5971】 LCMSum
  19. 对reducers 理解
  20. AngularJS:指令

热门文章

  1. 找不到 EntityType “ ” 的映射和元数据信息。
  2. Microsoft.NET.Framework开机报错解决方法
  3. Python单元测试框架之pytest 1 ---如何执行测试用例
  4. Java自定义数据验证注解Annotation
  5. client家族属性
  6. 搞懂webdriver的底层原理,才敢说自己懂自动化!
  7. AWS机器学习初探(2):文本翻译Translate、文本转语音Polly、语音转文本Transcribe
  8. 从知名外企到创业公司做CTO是一种怎样的体验?
  9. 无法启动程序,因为计算机中丢失mfc90ud.dll的解决方案
  10. 廖雪峰Java6 IO编程-2input和output-4Filter模式