欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Flex 学习之路之二十二 DataGrid的使用

程序员文章站 2022-07-07 23:18:32
...
<?xml version="1.0"?>
<!-- itemRenderers\sparkmx\myComponents\NSEditor.mxml -->
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
						  xmlns:s="library://ns.adobe.com/flex/spark"
						  xmlns:mx="library://ns.adobe.com/flex/mx">
	<fx:Script>
		<![CDATA[
			public var myRetVal:int = 0;
		]]>
	</fx:Script>
	<!-- Use the valueCommit event when the user selects the
	cell but does not change the value. -->
	<s:NumericStepper id="myNS"
					  value="{data.quant}"
					  stepSize="1"
					  maximum="50"
					  change="myRetVal=myNS.value;"
					  valueCommit="myRetVal=myNS.value;"/>
</s:MXDataGridItemRenderer>
<?xml version="1.0"?>
<!-- itemRenderers\sparkmx\SparkMainNSEditor.mxml -->
<s: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">
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			[Bindable]
			private var myDP:ArrayCollection = new ArrayCollection([
				{label1:"Order #2314", quant:3, Sent:true},
				{label1:"Order #2315", quant:3, Sent:false}
			]);
		]]>
	</fx:Script>
	<mx:DataGrid id="myDG" dataProvider="{myDP}"
				 variableRowHeight="true"
				 editable="true" >
		<mx:columns>
			<mx:DataGridColumn dataField="label1"
							   headerText="Order #"/>
			<mx:DataGridColumn dataField="quant"
							   itemEditor="myComponents.NSEditor"
							   editorDataField="myRetVal"/>
		</mx:columns >
	</mx:DataGrid>
</s:Application>


相关标签: datagrid flex

上一篇: js回车事件

下一篇: 程序十一