flex如何在后台读取数据动态添加组件(单选按钮,多选按钮,日期动态添加组件)最好有个例子 50
如://按钮var_btn:Button=newButton();_btn.label="按钮";_btn.x=12;_btn.y=20;this.addElement(...
如:
//按钮
var _btn:Button = new Button();
_btn.label = "按钮";
_btn.x = 12;
_btn.y = 20;
this.addElement(_btn);
这样弄!
我现在想知道多选按钮 日期组件 和单选按钮怎么弄 展开
//按钮
var _btn:Button = new Button();
_btn.label = "按钮";
_btn.x = 12;
_btn.y = 20;
this.addElement(_btn);
这样弄!
我现在想知道多选按钮 日期组件 和单选按钮怎么弄 展开
展开全部
private function changeGrid(length:Number):void{
var row:GridRow=new GridRow();
var item:GridItem=new GridItem();
var data:DateFieldEx = new DateFieldEx();
var label:Label=new Label();
var input:TextInputEx=new TextInputEx();
if(length<1){
length =1;
}
for(var i:int = 0 ;i < length ; i++){
row=new GridRow();
row.percentWidth=100;
row.setStyle("borderStyle", "solid");
row.setStyle("borderSides", "bottom");
row.setStyle("horizontalAlign", "center");
row.setStyle("borderThickness", "1.5");
row.setStyle("paddingBottom", "0");
row.setStyle("paddingTop", "0");
//日期
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
data = new DateFieldEx();
data.src="obj.RQ_"+linNum;
data.formatString="YYYY-MM-DD";
data.setStyle("borderStyle","none");
data.setStyle("textAlign","left");
data.percentWidth=100;
item.addChild(data);
row.addChild(item);
//凭证号
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.PZH_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//摘要
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.ZY_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//金额
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.JE_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","right");
input.restrict="-0-9.";
input.addEventListener(Event.CHANGE,inputChange);
input.addEventListener(FlexEvent.VALUE_COMMIT,formatNum);
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//备注
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.BZ_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
this.grid2.addChildAt(row,linNum+1);
linNum+=1;
}
}
这个是动态创建 grid 表格的!是否能帮到您
var row:GridRow=new GridRow();
var item:GridItem=new GridItem();
var data:DateFieldEx = new DateFieldEx();
var label:Label=new Label();
var input:TextInputEx=new TextInputEx();
if(length<1){
length =1;
}
for(var i:int = 0 ;i < length ; i++){
row=new GridRow();
row.percentWidth=100;
row.setStyle("borderStyle", "solid");
row.setStyle("borderSides", "bottom");
row.setStyle("horizontalAlign", "center");
row.setStyle("borderThickness", "1.5");
row.setStyle("paddingBottom", "0");
row.setStyle("paddingTop", "0");
//日期
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
data = new DateFieldEx();
data.src="obj.RQ_"+linNum;
data.formatString="YYYY-MM-DD";
data.setStyle("borderStyle","none");
data.setStyle("textAlign","left");
data.percentWidth=100;
item.addChild(data);
row.addChild(item);
//凭证号
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.PZH_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//摘要
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.ZY_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//金额
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.JE_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","right");
input.restrict="-0-9.";
input.addEventListener(Event.CHANGE,inputChange);
input.addEventListener(FlexEvent.VALUE_COMMIT,formatNum);
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
//备注
item=new GridItem();
item.percentWidth=20;
item.setStyle("borderStyle","solid");
item.setStyle("borderSides","right");
item.setStyle("paddingTop","0");
item.setStyle("paddingBottom","0");
item.setStyle("horizontalAlign","left");
input=new TextInputEx;
input.src="obj.BZ_"+linNum+"";
input.setStyle("borderStyle","none");
input.setStyle("textAlign","left");
input.percentWidth=100;
item.addChild(input);
row.addChild(item);
this.grid2.addChildAt(row,linNum+1);
linNum+=1;
}
}
这个是动态创建 grid 表格的!是否能帮到您
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询