Flex使用弹出窗口为DataGrid添加新数据
经常在Demo中会看到列表,表格等方式来显示数据。当然有时候也需要添加数据到这些列表或者表格中。有很多方式提交,这里展示一个弹出窗口的方式来添加新的数据到DataGrid中。
例子展示:
首先,我们开始建设一个基本的界面结构,一个带有“Notes"标题的Panel,一个DataGrid,以及一个用于提交数据的按钮。
Xml代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="500" height="300">
<mx:Panel title="Notes"
width="100%" height="100%"
layout="vertical" horizontalAlign="right"
paddingTop="3" paddingLeft="3" paddingRight="3" paddingBottom="3">
<mx:DataGrid width="100%" height="100%">
<mx:columns>
<mx:DataGridColumn headerText="Author" dataField="author" width="80"/>
<mx:DataGridColumn headerText="Topic" dataField="topic" width="100"/>
<mx:DataGridColumn headerText="Description" dataField="description"/>
</mx:columns>
</mx:DataGrid>
<mx:Button label="Add Note"/>
</mx:Panel>
</mx:Application> <?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="500" height="300">
<mx:Panel title="Notes"
width="100%" height="100%"
layout="v
相关文档:
对包含自定义命名空间的XML 进行分析是比较困难的, 它要求该命名空间一定要在任何XML 返回前被申明, 同时要在该命名空间内进行分析。比如对于以下的一个xml:
test.xml
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle= ......
1、arraycollection转化为xml,代码如下:
//动态生成树形结构
public static function flatArrayToXML(arr:Object,rootname:String=null,nodename:String=null, outputString:Boolean=false):Object{
if (arr is Array){
......
1、如果要设置Validator验证组件里面提示字的大小,可以在mxml中加入
<mx:Style>
<!--[CDATA[
.errorTip
{
fontSize: 12;
}
]]-->
</mx:Style>
2、设置tooltip中的样式(如字体大小,颜色)可在mxml中的creationComplete的initApp()加入
......
浏览器加载swf后,Flex组件自动获取输入焦点。
1.在flex中设置焦点
as3 代码
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationCom ......