Extjs Gridpanel 动态加载

colMArray_ljdj=[smQd,
                {header : /*"代销机构代码"*/"机构",    dataIndex : "dxjgdm",    width : 100},
                {header : /*客户名称*/"姓名",    dataIndex : "khmc",    width : 100},
                {header : /*"交易金额"*/"金额",    dataIndex : "jyje",    width : 100, renderer:jyje_format, align:"right"},
                {header : /*"交易日期"*/"预约日期",    dataIndex : "jyrq",    width : 100},
                   {header : /*"交易时间"*/"预约时间",    dataIndex : "jysj",    width : 100}, 
                   {header : "联系电话",    dataIndex : "yhdh",    width : 100},
                   {header : /*客户通知状态*/"目标客户",    dataIndex : "khtzzt",    width : 100},
                   {header : /*客户联系状态*/"订单联系状态",    dataIndex : "khlxzt",    width : 100},
                   {header : /*手工冻结状态*/"冻结状态",    dataIndex : "xgdjzt",    width : 100},
                   {header : "执行冻结",dataIndex: 'zxdj', width : 80, renderer:zxdj_btn},
                   {header : /*协议签约状态*/"签约状态",    dataIndex : "xyqyzt",    width : 100},
                   {header : "扣款状态",    dataIndex : "kkzt",    width : 100},
                   {header : "扣款",dataIndex: 'kk', width : 80, renderer:kk_btn}];
function zxdj_btn(value, metaData, record, rowIndex, colIndex, store){
    var lsh = record.data['lsh'];
    var jyje_arr = record.data['jyje'].split(",");
    var jyje = "";
    for(var j = 0; j< jyje_arr.length; j++){
        jyje += jyje_arr[j];
    }
    jyje = parseFloat(jyje);
    if(((record.data['ywdm'] == '901')&&(record.data['xgdjzt'].split("-")[0] == 0))||((record.data['ywdm'] == '902')&&(record.data['khlxzt'].split("-")[0] == 1) && (record.data['xgdjzt'].split("-")[0] == 0))){
        return "<div align='center'><button style='cursor:hand' onclick='ybdj(""+lsh+"",""+jyje+"")'><font size='1'>执行</font></button></div>";
    }else if((record.data['ywdm'] == '902')&&(record.data['xgdjzt'].split("-")[0] == 2)&&(record.data['kkzt'].split("-")[0] == 0)){
        return "<div align='center'><button style='cursor:hand;' onclick='qxdj(""+lsh+"")'><font size='1'>取消执行</font></button></div>";
    }else{
        return "<div align='center'><button style='cursor:hand;' disabled onclick=''><font size='1'>执行</font></button></div>";
    }
    /*
    if((record.data['xgdjzt'].split("-")[0] == 2)||(record.data['khlxzt'].split("-")[0] == 0)){
        return "<div align='center'><button style='cursor:hand;' disabled onclick='ybdj(""+lsh+"")'><font size='1'>执行</font></button></div>";
    }else{
        return "<div align='center'><button style='cursor:hand' onclick=''><font size='1'>执行</font></button></div>";
    }*/
}

function kk_btn(value, metaData, record, rowIndex, colIndex, store){
    var lsh = record.data['lsh'];
    if((record.data['xgdjzt'].split("-")[0] == 2)&&(record.data['kkzt'].split("-")[0] == 0)){
        return "<div align='center'><button style='cursor:hand' onclick='kk(""+lsh+"")'><font size='1'>扣款</font></button></div>"
    }else{
        return "<div align='center'><button style='cursor:hand' disabled onclick=''><font size='1'>扣款</font></button></div>"
    }
}

function jyje_format(value, metaData, record, rowIndex, colIndex, store){
    if(value != null && value != ""){
        return rendererZhMoney(value);
    }else{
        return value;
    }
}
原文地址:https://www.cnblogs.com/mingforyou/p/3364272.html