about Flex DataGrid edit
Summary(概述): Adobe Flex 的 dataGrid 有很强大的功能,比如ItemRenderer,headerRenderer等,可以方便地实现自己想要的功能。但对dataGrid直接编辑并保存到Service端,就有点麻烦了。
Requirement(需求): 对dataGrid进行单位格编辑,若有变化,保存到Service; 否则不保存。
Solution(解决方案): 运用DataGrid 的 itemEditBegin 事件、itemFocusOut 事件。
1. when the itemEditBegin is dispatched, the event handler should save this cell value as old value.(编辑前保存旧值)
2. when the listener of itemFocusOut is responding, you should check the current cell to the old value. If it's value have changed, you should save the new value to Service.(编辑后判断,是否更改。)
Example(例子) as follow:
<mx:Script>
<![CDATA[
private var oldValueOfEditedItem: CreditVO;
private function creditDGEditBegin(event: DataGridEvent): void {
oldValueOfEditedItem = (event.itemRenderer.data as CreditVO).clone() as CreditVO;
}
private function editedItemChanged(newValue: CreditVO): Boolean {
return (newValue.amount != oldValueOfEditedItem.amount)||
(newValue.description != oldValueOfEditedItem.description);
}
private function creditDGEditEnd(event: DataGridEvent): void {
var newValue: CreditVO = event.itemRenderer.data as CreditVO;
if (editedItemChanged(newValue)) {
dispatchEvent(new UpdateCreditEvent(newValue))
}
}
]]>
&
相关文档:
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 ......
首先建一个netbeans的java web项目
然后从网上吧blazeds.war 下载下来用rar 解压 把web-inf 替换掉在netbeans\web 下面的web-inf中的全部文件
然后 部署下
在打开flex builder 新建一个flex project 写上名字和项目路径
在Application server type 选中j2ee
点击 下一步
然后 Root folder选中net ......
一、Application常用的事件
initialize=============>初始化
createcomplate==========>元素加载完
initialize发生在createcomplate之前。
二、数据请求说明
HTTPService==========>http数据请求。
SOAP(Simple Object Access Protocal)=======> webService
AMF(Adobe Action Message Format)========&g ......
返回数据的格式resultFormat有几种类型,object、array、xml、flashvars、text和e4x,默认的设置为object。
RESULT_FORMAT_ARRAY : String = "array"
[] 结果格式“array”与“object”相似,但是其返回的值始终为数组;这样,如果从结果格式“object”返回的结果尚不是数组,则将把该项 ......