flex中dataGrid的编辑功能
在flex的dataGrid中,很多情况下列是需要嵌入其他的控制的,比如:checkbox,combox等,此时需要利用dataGrid的如下功能:
1.datagrid编辑功能简介
当我们点击datagrid中的一个单元格进行编辑时,可结合使用一些组件,RadioButtonGroup、checkbox、ComboBox等
datagrid的编辑功能必须使用以下组件:editorDataField、itemEditor和itemRenderer。
editorDataField 属性确定包含新数据的项目编辑器的属性,并使用这些新数据更新数据提供程序项目。因为默认项目编辑器是 TextInput 控件,所以 editorDataField 属性的默认值为 "text",以指定 TextInput 的 text 属性包含新项目数据。
itemEditor为DataGrid的单元格编辑器,而itemRenderer则为渲染器,就是说.itemEditor只会在单元格处理编辑状态下才会出现.
itemRenderer则是一直显示(就是网友关心的,自定义DataGrid的列)
datagrid各项数据编辑后的保存
不要一个一个地从datagrid中读取各项的值,最好通过Arraycollection数据源与datagrid进行绑定,如果需要读取编辑后的数值,可以直接读取ArrayCollection。具体看本文《datagrid控件的各项数据可编辑》。
2.editorDataField使用方法
属性描述:
public var editorDataField:String = "text"
项目编辑器的属性名称,其中包含列表项目的新数据。例如,默认的 itemEditor 为 TextInput,因此,editorDataField 属性的默认值为 "text",此值指定 TextInput 控件的 text 属性。
例1:
<mx:DataGridColumn headerText="名称" id="dg2" dataField="name" editable="true" editorDataField="text"/>
以上代码说明表示"名称"这一列可通过TextInput控件编辑,并将TextInput控件的text属性值传给DataGridColumn。editorDataField="text"是默认值,可不写。
例2:
<mx:DataGridColumn headerText="价格" id="dg3" dataField="price" editorDataField="value" editable="false">
<mx:itemRenderer>
 
相关文档:
Flex中通过继承可以为新组件增加新的功能,如通过注入方法,改变背景色,改变位置和高度等。这里主要掌握原组件的一些特性,属性和方法,以便根据需要的功能加以覆写(也可以自己扩展),达到自己想要的效果。下面是一个简单的例子
1、新建MyDataGrid.as,继承DataGrid,覆写drawRowBackground方法,注入rowColorFunction方 ......
<?xml version="1.0"?>
<!-- charts/PredefinedAxisStyles.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
//导入相关包
import mx.collections.ArrayCollection;
import mx.charts.*;
import mx.charts.ser ......
Flex中Image加载图片出错时显示默认图片的方法主要有以下几种:
方法一:利用 brokenImageSkin 风格显示一个默认的图,只需设置CSS就行了,如下:
<mx:Style>
Image {
brokenImageSkin: Embed("assets/404.jpg");
}
</m ......
First, enough bytes for frame 1 are streamed down to the Flash
Player.
The Flash Player executes those bytes by creating a SystemManager
instance.
SystemManager instruct the Flash Player to stop at the end of frame
1.
SystemManager then goes on to create the Preloader which creates the ......
一般来讲,在windows上安装软件从来都不是什么难事儿,但FMS却在安装过程中"充满"了误导(好吧,其实也就是夸张的说法而已)
1.下载FMS3.5
http://www.adobe.com/products/flashmediainteractive/?promoid=DJDTG
这上面有一个免费开发版(除了连接数有限制,其它功能完全一样)
2.一路Next安装
注 ......