| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" width="900" height="700" |
| xmlns:comps="comps.*" > |
| <s:layout> |
| <s:VerticalLayout /> |
| </s:layout> |
| <fx:Script> |
| <![CDATA[ |
| |
| import mx.collections.*; |
| import mx.controls.*; |
| import mx.events.DataGridEvent; |
| import mx.controls.dataGridClasses.*; |
| import mx.controls.listClasses.*; |
| |
| [Bindable] |
| public var contacts1:Array = [ |
| {Photo: 5}, {Photo: 6}, {Photo: 8}, {Photo: 10} |
| ]; |
| |
| [Bindable] |
| public var ac:ArrayCollection = new ArrayCollection([ |
| {col1:"col1-1",col2:"col2-1",col3:"col3-1",col4:null,col5:"col5-1",col6:"col6-1"}, |
| {col1:"col1-2",col2:"col2-2",col3:"col3-2",col4:null,col5:"col5-2",col6:"col6-2"}, |
| {col1:"col1-3",col2:"col2-3",col3:"col3-3",col4:null,col5:"col5-3",col6:"col6-3"}, |
| {col1:"col1-4",col2:"col2-4",col3:"col3-4",col4:null,col5:"col5-4",col6:"col6-4"}, |
| {col1:"col1-5",col2:"col2-5",col3:"col3-5",col4:null,col5:"col5-5",col6:"col6-5"}, |
| {col1:"col1-6",col2:"col2-6",col3:"col3-6",col4:null,col5:"col5-6",col6:"col6-6"}, |
| {col1:"col1-7",col2:"col2-7",col3:"col3-7",col4:null,col5:"col5-7",col6:"col6-7"}, |
| {col1:"col1-8",col2:"col2-8",col3:"col3-8",col4:null,col5:"col5-8",col6:"col6-8"}, |
| {col1:"col1-9",col2:"col2-9",col3:"col3-9",col4:null,col5:"col5-9",col6:"col6-9"}, |
| {col1:"col1-10",col2:"col2-10",col3:"col3-10",col4:null,col5:"col5-10",col6:"col6-10"}, |
| {col1:"col1-11",col2:"col2-11",col3:"col3-11",col4:null,col5:"col5-11",col6:"col6-11"}, |
| {col1:"col1-12",col2:"col2-12",col3:"col3-12",col4:null,col5:"col5-12",col6:"col6-12"} |
| ]); |
| |
| public function doTest(event:DataGridEvent):void |
| { |
| event.preventDefault(); |
| |
| if(event.columnIndex==2) |
| { |
| var myfocus:Object = {columnIndex:event.columnIndex, rowIndex:event.rowIndex}; |
| dataGrid_basic.editedItemPosition = myfocus; |
| dataGrid_basic.createItemEditor(event.columnIndex, event.rowIndex); |
| |
| if (dataGrid_basic.editedItemRenderer is IDropInListItemRenderer && dataGrid_basic.itemEditorInstance is IDropInListItemRenderer) |
| IDropInListItemRenderer(dataGrid_basic.itemEditorInstance).listData = IDropInListItemRenderer(dataGrid_basic.editedItemRenderer).listData; |
| |
| dataGrid_basic.itemEditorInstance.data = dataGrid_basic.editedItemRenderer.data; |
| } |
| } |
| |
| public function finishEdit(event:DataGridEvent) : void |
| { |
| event.preventDefault(); |
| dataGrid_basic.destroyItemEditor(); |
| } |
| |
| public function changeLabel(obj:Object, col:Object):String |
| { |
| if(obj.Available) |
| { |
| return "Yes"; |
| } |
| else |
| { |
| return "No"; |
| } |
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <fx:Style source="../../../../../Assets/Fonts/myStyles.css" /> |
| |
| <mx:HBox> |
| <mx:DataGrid editable="true" id="dataGrid_custom" |
| dataProvider="{contacts1}" width="300" > |
| <mx:columns> |
| <mx:DataGridColumn headerRenderer="comps.MyHeader" dataField="Photo" /> |
| </mx:columns> |
| </mx:DataGrid> |
| |
| <mx:DataGrid editable="true" id="dataGrid_text" |
| dataProvider="{contacts1}" width="300" > |
| <mx:columns> |
| <mx:DataGridColumn headerRenderer="mx.controls.Text" dataField="Photo" /> |
| </mx:columns> |
| </mx:DataGrid> |
| </mx:HBox> |
| |
| <mx:HBox> |
| <mx:DataGrid editable="true" id="dataGrid_label" |
| dataProvider="{contacts1}" width="300" > |
| <mx:columns> |
| <mx:DataGridColumn dataField="Photo" > |
| <mx:headerRenderer> |
| <fx:Component> |
| <mx:Label color="0x0000FF" fontSize="15" /> |
| </fx:Component> |
| </mx:headerRenderer> |
| </mx:DataGridColumn> |
| </mx:columns> |
| </mx:DataGrid> |
| |
| <mx:DataGrid editable="true" id="dataGrid_textinput" |
| dataProvider="{contacts1}" width="300" > |
| <mx:columns> |
| <mx:DataGridColumn headerRenderer="mx.controls.TextInput" dataField="Photo" /> |
| </mx:columns> |
| </mx:DataGrid> |
| </mx:HBox> |
| |
| <mx:HBox> |
| <mx:DataGrid id="dataGrid_basic" dataProvider="{contacts1}" /> |
| <mx:DataGrid dataProvider="{ac}" editable="true" id="dataGrid_null"> |
| <mx:columns> |
| <mx:DataGridColumn dataField="col3" editable="false"/> |
| <mx:DataGridColumn dataField="col4" itemRenderer="mx.controls.DateField" rendererIsEditor="true" editorDataField="selectedDate" /> |
| <mx:DataGridColumn dataField="col5" editable="false"/> |
| </mx:columns> |
| </mx:DataGrid> |
| </mx:HBox> |
| |
| </s:Application> |