Tag Archives: DataGridColumn

DragDrop时, 使用DragEvent.dragInitiator来获得Drag源头, 而非DragEvent.relatedObject

首发: http://riashanghai.com/node/123 问题描述: 在进行DragDrop时, 我使用了DragDrop.relatedObject来获得Drag触发的UIComponent 如: var dargUI:TileList = e.relatedObject as TileList; 在AIR中运行, 可用且没有任何错误, 但当使用浏览器版本时, e.relatedObject为null, 上一行代码报错.   解决方法: 因此, 如果需要在两种环境中都可以运行, 应使用e.dragInitiator来获取Drag触发的源头: //———————————- // dragInitiator 来源: DragEvent //———————————- /** * The component that initiated the drag. */ public var dragInitiator:IUIComponent;

Posted in ActionScript | Tagged , , , , | Leave a comment

使用ActionScript建立DataGrid, 添加右键, 增加列, 并设定列的ItemRenderer

很多时候为了获得对组件的灵活控制, 不得不放弃MXML, 直接使用ActionScript.

Posted in ActionScript | Tagged , , , , | 6 Comments

使用ItemRenderer处理基于List容器的显示内容 [DataGrid, Tree, List等]

如Student中有一Gender_属性, 1表示男生, 2表示女生, 3表示未知, 现在有下要求: 1. 在DataGrid中不可以显示1, 2,3, 应显示 男女 [ 该功能可由LabelFunction实现], 2. 如果为男生,, 则”男生”颜色为红色, 女生颜色为默认, 未知字体大小为10号

Posted in ActionScript | Tagged , , | Leave a comment

使用labelFunction处理DataGrid显示内容

在设定了DataGrid的DataProvider, 设定DataGridColumn及其相应的DataField之后, DataGrid就可正常显示, 但有时候需要稍微处理一下显示内容: 如 某ArrayCollection中含有一组Student, Student对象具有gender属性, 其中1代表男, 2代表女, 3代表不确定. 此时需要使用labelFunction进行处理显示内容.

Posted in Flex | Tagged , , | 3 Comments

Flex中获得DataGrid中编辑前后的数据

问题: 在使用DataGrid进行数据编辑时, 我们不可避免的需要对数据的输入进行检验, 修正等错误. 解决方法: 监听DataGrid的editEnd事件:DataGridEvent.ITEM_EDIT_END.改事件中包含有正在编辑的DataGridColumn[列名], 编辑前的数据, 编辑结束后的数据, 等等 具体实现: 1. 获得当前编辑的DataGridColumn;  2. 获得编辑前后的数据; /** * 响应EditEnd * 获得当前编辑的DataGridColumn; 2. 获得编辑前后的数据; */ private function onEditEnd(e:DataGridEvent):void { var beingEditField:String = e.dataField; //获得当前列的dataField if(beingEditField == “locale”) { var oldLocal:String = e.itemRenderer.data.locale; var …

Posted in Flex | Tagged , , | 4 Comments