dorado总结

dorado代码积累

1.编写AjaxAction的onSuccess函数:

dorado.MessageBox.alert(self.get("returnValue"));

2.dialog开启关闭:

view.get("#dialog").show();
view.get("#dialog").hide();

3.获取dataset当前数据。给htmlContainer赋值。

var entity = view.id('dataSet').get("data:#");
var content = entity.get("content");
view.get("#htmlContainer").removeAllChildren();
view.get("#htmlContainer").set("content",content);

4.动态创建autoform

var total = arg.dataSet._data._keyMap;//三条数据汇总
var count=1;
var temp=0;
var temp1=0;
for (var list in total){//循环总数据
    for(var key in total[list]._data){//循环每条数据
        if(key!="$dataType"  &&  key!="type" && key!="id" && key!="q1"){
        if(total[list]._data[key]!=null){
                if(count==1){
                    var e= new dorado.widget.autoform.AutoFormElement();
                    var e1= new dorado.widget.autoform.AutoFormElement();
                    e.set("label",total[list]._data[key]);
                    e.set("name",key);
                    e1.set("label",total[list]._data[key]);
                    e1.set("name",key);
                    view.get("#autoform1").addElement(e);
                    view.get("#autoform2").addElement(e1);
                }else if(count==2){
                  view.get("#autoform1")._children[temp].set("value",total[list]._data[key]);
                    temp++;
                }else if(count==3){
                    view.get("#autoform2")._children[temp1].set("value",total[list]._data[key]);
                    temp1++;
                }
            }
        }
    }
    count++;
}

view.get("#ajaxAction5").set("parameter",${request.getParameter("taskId")}).execute(
function(flag){
if(flag==true){
var total = arg.dataSet._data._keyMap;//数据汇总
for (var list in total){//循环总数据
    var tab=new dorado.widget.tab.ControlTab({caption:total[list]._data["fzbm"]+"行动计划"});
    var field=new dorado.widget.FieldSet({caption:"行动计划"})
    var autoform=new dorado.widget.AutoForm({id:'xdjh'+list,cols:'*',labelSeparator:':',labelWidth:150,readOnly:true});
    var a= new dorado.widget.autoform.AutoFormElement({label:'部门行动计划名称'});
    var b= new dorado.widget.autoform.AutoFormElement({label:'部门行动计划内容'});
    var c= new dorado.widget.autoform.AutoFormElement({label:'负责部门'});
    var d= new dorado.widget.autoform.AutoFormElement({label:'部门损失分配比例'});
    var e= new dorado.widget.autoform.AutoFormElement({label:'部门损失分配说明'});
    var f= new dorado.widget.autoform.AutoFormElement({label:'预计完成日期'});
    var g= new dorado.widget.autoform.AutoFormElement({label:'预计开始日期'});
        autoform.addElement(a);
        autoform.addElement(b);
        autoform.addElement(c);
        autoform.addElement(d);
        autoform.addElement(e);
        autoform.addElement(g);
        autoform.addElement(f);
        field.addChild(autoform);
        tab._control=field;
        //tab._control._actualVisible=true;
        view.get("#control1").addTab(tab,2,true);
        autoform._children[0].set("value",total[list]._data.xdjhmc);
        autoform._children[1].set("value",total[list]._data.xdjhnr);
        autoform._children[2].set("value",total[list]._data.fzbm);
        autoform._children[3].set("value",total[list]._data.bmssfpbl);
        autoform._children[4].set("value",total[list]._data.bmssfpsm);
        autoform._children[5].set("value",total[list]._data.yjksrq);
        autoform._children[6].set("value",total[list]._data.yjwcrq);
}
}
});

5.datagrid对固定行进行操作

var value;//金额
var xs;//系数
var totalval=0;//总计金额
var totalval2=0;//折后总计金额
var val=0;
var val2=0;
var model = view.get("#datagridldxfgl").get("itemModel");
var total = model.getItemCount();//获取总行数
var item = view.get("#datagridldxfgl").getCurrentItem();//获取行的对象
var index = model.getItemIndex(item);//获取本行索引
if(index!=0){
value = model.getItemAt(index).get("je");
xs = model.getItemAt(index).get("zsxs");
model.getItemAt(index).set("zshje",parseFloat(value*xs).toFixed(2));
for(var i = 1; i 

6.

dorado.MessageBox.confirm("请作出您的选择...", function() {
    dorado.widget.NotifyTipManager.notify("您选择了\"是\"。");
});  

7.

if(arg.data._data.fname =="股票型基金" || arg.data._data.fname =="可转债"){
arg.dom.style.backgroundColor="#ffa500";
}  

 

你可能感兴趣的:(知识点积累)