4,328
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
internal var datas:Array = new Array();
function init():void
{
//datas = new Array();
for(var i:int=1;i<10;i++)
{
datas.push(i);
}
//cmbModel.dataProvider = datas;
}
]]>
</mx:Script>
<mx:ComboBox id="cmbModel" x="51" y="71" dataProvider="{datas}"></mx:ComboBox>
<mx:DataGrid x="312" y="70" dataProvider="{cmbModel.selectedItem}">
<mx:columns>
<mx:DataGridColumn headerText="number"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var comboStore:Array = ["2010","2011","2012"];
[Bindable]
public var gridStore:ArrayCollection = new ArrayCollection([{id:"001",year:"2011"}]);
private function show():void
{
}
]]>
</mx:Script>
<mx:DataGrid width="400" height="200" dataProvider="{gridStore}" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="id" />
<mx:DataGridColumn dataField="year" editorDataField="text">
<mx:itemEditor>
<mx:Component>
<mx:ComboBox dataProvider="{outerDocument.comboStore}" labelField="name"/>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid width="400" height="200" dataProvider="{gridStore}">
<mx:columns>
<mx:DataGridColumn dataField="id" />
<mx:DataGridColumn dataField="year" editorDataField="text">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox dataProvider="{outerDocument.comboStore}" labelField="name"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>
// 修改了莫行记录的某个属性值,要让表格重新显示
record.id = "001";
record.name = "changed";
gridStore.itemUpdated(record);
// 增加一条记录到末尾
gridStore.addItem(record);
// 增加一条记录到指定位置
gridStore.addItemAt(record, index);
// 移除全部数据
gridStore.removeAll();
// 移除一条记录
gridStore.removeItemAt(index);
// 移除表格中选中的那行记录第一种方式
gridStore.removeItemAt(dataGrid.selectedIndex);
// 移除表格中选中的那行记录第二种方式
var index:int = gridStore.getItemIndex(dataGrid.selectedItem);
gridStore.removeItemAt(index);
// 刷新数据,表格重新显示数据
gridStore.refresh();
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Style>
Panel{
font-size:13;
font-style:normal;
color:black;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
public var cards:ArrayCollection=new ArrayCollection([{label: "请选择", data: 1}, {label: "长度", data: 2}, {label: "形式", data: 3}, {label: "顶宽", data: 4}, {label: "墙高", data: 5}, {label: "斜面坡度", data: 6}]);
public var cards2:ArrayCollection=new ArrayCollection([{label: "请选择", data: 1}, {label: "=", data: 2}, {label: ">", data: 3}, {label: "<", data: 4}, {label: "+", data: 5}, {label: "-", data: 6}, {label: "*", data: 6}, {label: "/", data: 6}, {label: "%", data: 6},]);
public var cards1:ArrayCollection=new ArrayCollection([{label: "请选择", data: 1}, {label: "(", data: 2}, {label: ")", data: 3}]);
public var cards3:ArrayCollection=new ArrayCollection([{label: "请选择", data: 1}, {label: "and", data: 2}, {label: "or", data: 3}, {label: "not", data: 4}, {label: "in", data: 5}, {label: "not in", data: 6}]);
public var cards4:ArrayCollection=new ArrayCollection([{label: "请选择", data: 1}, {label: "专业q", data: 2}, {label: "oh my god", data: 3},
]);
[Bindable]
public var gridStore:ArrayCollection = new ArrayCollection();
private function xuanze(e:Event):void
{
xuhao.dataField="" + ComboBox(e.target).selectedItem.label;
}
private function saveTemplate():void
{
var record:Object = {};
record.tiaojianzhi = zhuanye.selectedItem.label;
record.tiaojain = tiaoJianYuLan.selectedItem.label;
record.xuhao = baoHanGuanXi.selectedItem.label;
record.yunsuan = yunSuanFu.selectedItem.label;
record.luoji = luoJiGuanXi.selectedItem.label;
gridStore.addItem(record);
}
]]>
</mx:Script>
<mx:XMLList id="test">
<testDom>
<xuhao>
</xuhao>
<luoji>haha!</luoji>
<tiaojain>yes</tiaojain>
<yunsuan>+</yunsuan>
<tiaojianzhi>al;ksdjf</tiaojianzhi>
</testDom>
<testDom>
<xuhao>2</xuhao>
<luoji>haha!</luoji>
<tiaojain>yes</tiaojain>
<yunsuan>+</yunsuan>
<tiaojianzhi>al;ksdjf</tiaojianzhi>
</testDom>
</mx:XMLList>
<mx:Panel x="0"
y="0"
width="100%"
height="100%"
layout="absolute"
title="定义条件查询模板"
fontWeight="bold">
<mx:Label x="10"
y="10"
text="条件模板名称:"
width="116"
height="24"
fontSize="13"
id="ts"/>
<mx:TextInput x="109"
y="8"
id="tiaojian"
width="559"
height="24"/>
<mx:Label x="10"
y="42"
text="专 业 名 称 :"
width="97"/>
<mx:Label x="10"
y="72"
text="条 件 名 称 :"
width="116"/>
<mx:Label x="383.5"
y="45"
text="条件值:"
width="113"/>
<mx:TextArea x="458"
y="44"
height="28"
width="210"/>
<mx:Label x="26"
y="102"
text="运 算 符 :"
width="116"
height="23"/>
<mx:Label x="387"
y="78"
text="逻辑关系:"
width="79"/>
<mx:Label x="387.5"
y="108"
text="包含关系:"
width="78.5"/>
<mx:Label x="51"
y="158"
text="备注:"
fontSize="16"/>
<mx:TextArea x="132.5"
y="148"
width="489.5"/>
<mx:Label x="10"
y="210"
text="条 件 预 览 :"
width="146"/>
<mx:ComboBox x="109"
y="39"
width="190"
dataProvider="{cards4}"
id="zhuanye"
textAlign="center">
</mx:ComboBox>
<mx:ComboBox x="109"
y="69"
width="190"
dataProvider="{cards}"
id="tiaoJianYuLan"
textAlign="center"
close="xuanze(event)">
</mx:ComboBox>
<mx:ComboBox x="458"
y="105"
width="210"
id="baoHanGuanXi"
dataProvider="{cards1}"
textAlign="center">
</mx:ComboBox>
<mx:ComboBox x="109"
y="99"
width="190"
dataProvider="{cards2}"
id="yunSuanFu"
textAlign="center">
</mx:ComboBox>
<mx:ComboBox x="458"
y="75"
id="luoJiGuanXi"
dataProvider="{cards3}"
width="210"
textAlign="center">
</mx:ComboBox>
<mx:DataGrid x="26"
y="240"
width="642"
height="100"
dataProvider="{gridStore}"
textAlign="center">
<mx:columns>
<mx:DataGridColumn headerText="序号"
id="xuhao"/>
<mx:DataGridColumn headerText="逻辑关系"
dataField="luoji"
id="d"/>
<mx:DataGridColumn headerText="条件名称"
dataField="tiaojain"/>
<mx:DataGridColumn headerText="运算符"
dataField="yunsuan"/>
<mx:DataGridColumn headerText="条件值"
dataField="tiaojianzhi"/>
</mx:columns>
</mx:DataGrid>
<mx:Label x="10"
y="387"
text="模 板 列 表 :"
color="#121111"/>
<mx:Button x="156"
y="359"
label="保存模板"
click="saveTemplate()"
width="117"/>
<mx:Button x="438.5"
y="359"
label="查询"
width="110"/>
<mx:DataGrid x="26"
y="417"
width="642"
height="51"
id="data"
rowCount="5">
<mx:columns>
<mx:DataGridColumn headerText="序号"
dataField="col1"
width="80"/>
<mx:DataGridColumn headerText="模板名称"
dataField="col2"
width="100"/>
<mx:DataGridColumn headerText="模板内容"
dataField="col3"
width="100"/>
<mx:DataGridColumn headerText="备注"
dataField="col4"
width="100"/>
<mx:DataGridColumn headerText="创建时间"
dataField="col5"
width="100"/>
<mx:DataGridColumn headerText="操作"
dataField="col5"
width="200"/>
</mx:columns>
</mx:DataGrid>
<mx:HRule x="10"
y="577"
strokeColor="#070707"
width="323"
height="0"/>
<mx:HRule x="10"
y="585"
width="807"
strokeColor="#080808"/>
<mx:LinkButton x="10"
y="595"
label="定义条件查询模板"
width="155"/>
<mx:LinkButton x="557"
y="442"
label="修改"
width="54"/>
<mx:LinkButton x="508"
y="442"
label="查看"
width="52"/>
<mx:LinkButton x="619"
y="442"
label="删除"
width="49"/>
</mx:Panel>
</mx:Application>