Extjs gridPanel 动态指定表头详解编程语言

var colMArray = new Array(); 
colMArray = [{header : "产品代码",    dataIndex : "cpdm",    width : 100}, 
            {header : "代销机构代码",    dataIndex : "dxjgdm",    width : 100}, 
            {header : "总份额",    dataIndex : "zfe",    width : 100, align:"right"}         ]; 
 
var colQd = new Ext.grid.ColumnModel(colMArray); 
 
 
function selinfo(){ 
    var cpdm_sel = Ext.get("cpdm").getValue(); 
    var dxjgdm_sel = Ext.get("dxjgdm").getValue(); 
    var select_method_sel = Ext.get("cpdm_radio").getValue(); 
    if(document.getElementById("dxjgdm_radio").checked){ 
        select_method_sel = Ext.get("dxjgdm_radio").getValue(); 
        colMArray[0] = {header : "代销机构代码",    dataIndex : "dxjgdm",    width : 100}; 
        colMArray[1] = {header : "产品代码",    dataIndex : "cpdm",    width : 100}; 
    }else{ 
        colMArray[0] = {header : "产品代码",    dataIndex : "cpdm",    width : 100}; 
        colMArray[1] = {header : "代销机构代码",    dataIndex : "dxjgdm",    width : 100}; 
    } 
    var params = {}; 
    params.cpdm_sel = cpdm_sel; 
    params.dxjgdm_sel = dxjgdm_sel; 
    params.select_method_sel = select_method_sel; 
    //params.whereStr = " and feetype in ('1','2')"; 
    storeCpye.baseParams = params; 
    colQd = new Ext.grid.ColumnModel(colMArray); 
    //gridCpye.reconfigure(storeCpye,colQd), 
    storeCpye.load({ 
        callback : function(r, options, success) { 
            if (success == true){ 
                gridCpye.reconfigure(storeCpye,colQd); 
            }else if (success == false) { 
                Ext.Msg.alert("错误", storeCpye.reader.jsonData.msg); 
            } 
        } 
    }); 
}

 

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/13229.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论