<?xml version="1.0"?>
<!-- DataGrid control example. -->
<mx: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" creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
[Bindable]
private var employees:ArrayCollection=new ArrayCollection([{name:"test1",count:1,total:10},{name:"test2",count:1,total:10},{name:"test3",count:1,total:10}]);
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
}
protected function button1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if(dg.selectedItem!=null){
var d:Object=dg.selectedItem;
d.count=int(d.count)+1;
employees.setItemAt(d,employees.getItemIndex(d));
}else{
Alert.show("请先选择数据!");
}
}
]]>
</fx:Script>
<mx:Panel title="DataGrid Control Example" height="100%" width="100%"
paddingTop="10" paddingLeft="10" paddingRight="10">
<s:Button label="点击" click="button1_clickHandler(event)"/>
<mx:Label width="100%" color="blue"
text="Select a row in the DataGrid control."/>
<mx:DataGrid id="dg" width="100%" height="100%" dataProvider="{employees}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/>
<mx:DataGridColumn headerText="进度条">
<mx:itemRenderer>
<fx:Component>
<mx:Canvas updateComplete="updateCompleteHandler(event,data)" creationComplete="canvas1_creationCompleteHandler(event,data)" >
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function updateCompleteHandler(event:FlexEvent,d:Object):void
{
// TODO Auto-generated method stuba
pb.setProgress(Number(d.count),Number(d.total));
}
protected function canvas1_creationCompleteHandler(event:FlexEvent,d:Object):void
{
pb.minimum=0;
pb.maximum=Number(d.total);
// TODO Auto-generated method stub
}
]]>
</fx:Script>
<mx:ProgressBar direction="right" mode="manual" width="100%" id="pb">
</mx:ProgressBar>
</mx:Canvas>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>
分享到:
相关推荐
通过itemrender实现flex datagrid中显示序列号
Flex dataGrid 全选、反选 checkBox 不是很完善,但很有借鉴意义
flex-datagrid-advancedDataGrid-demo,做的datagrid及advanceddatagrid的例子,希望大家喜欢
flex datagrid 实现合计功能控件包 带源码,demo fxp是flex4的工程文件,导入到工作空间即可 直接导入项目即可。 更多访问我的blog www.dplayer.net
在FLEX4中开发带有过滤功能的DATAGRID组件
这个分页只与后台交互一次,然后将获得的集合在前台进行分页显示。
flex datagrid 改变指定行的背景颜色,可直接使用
Flex DataGrid从XML文件中加载数据
flex DataGrid中文字符排序类 用法见 http://blog.sina.com.cn/s/blog_5fc933730100iign.html
flex datagrid资料,下载的别人的,想弄点分数啊
Flex的DataGrid中使用CheckBox. 大家共同研究
成功的实现了,datagrid中嵌套checkbox实现全选的功能。分享代码供大家分享。项目为flex3。
felx和springHibernate整合传递二进制数据到表中并在flex的dataGrid控件中显示的实践
NULL 博文链接:https://lqw.iteye.com/blog/537409
将flex中datagrid组件中数据导出到excel表格中。思路很简单,利用as将datagrid中的数据解析出来,传到后台java服务端处理,即可保存为excel文件。
NULL 博文链接:https://windmark.iteye.com/blog/1716422
flex中dataGrid导出数据到excel中,不存在乱码问题
flex 通过读取xml文件 实现动态DataGrid数据列表
flex Datagrid checkbox全选 Datagrid
FLEX的datagrid合计、平均值,很好的例子代码拿来就可以用