Extjs GridPanle列动态隐藏


Ext.onReady(function() {
/*****************/
var currentWeek=0;
Ext.Ajax.request({
url : './dept/getCurrentWeek.do',
params : '',
method : 'POST',
async: false,
success : function(response, options) {
currentWeek = response.responseText;
},
failure : function() {
Ext.Msg.alert("提示信息", "按钮加载失败,请稍后重试!");
}
});
ajax同步,需要增加扩展类,
下一步,根据当前的currentWeek,确定哪些列需要显示.
var ObtainPhoneType = Ext.data.Record.create(['id', 'w20', 'w21', 'w22', 'w23']);

var initObtainPhoneType = {};

var obtain_phone_type_columns = [
{
header : "ID编号",
align : 'center',
width : 80,
sortable : false,
dataIndex : 'id'
},
{
header : "W20",
align : 'center',
width : 80,
sortable : false,
dataIndex : 'w20',
hidden:true
},
{
header : "W21",
align : 'center',
width : 80,
sortable : false,
dataIndex : 'w21',
hidden:false
},
{
header : "W22",
align : 'center',
width : 80,
sortable : false,
dataIndex : 'w22',
hidden:true
},
{
header : "W23",
align : 'center',
width : 80,
sortable : false,
dataIndex : 'w23',
hidden:true
}
];
var obtain_phone_type_api = {
read : '',
update : '',
create : '',
destroy : ''
}
try{
// create grid
var obtain_phone_type_grid = new Fee.grid.EditBaseGridPanel(obtain_phone_type_api, ObtainPhoneType,
initObtainPhoneType, obtain_phone_type_columns, 'id', {
limit : 32,
addBtn : false,
autoSave : false
});
//currentWeek=parseInt(currentWeek);
var count=1;
if(...){
obtain_phone_type_grid.colModel.setHidden(1,false);//隐藏第2列,下标有0 开始,1为index计数.非dataIndex
obtain_phone_type_grid.colModel.setHidden(2,false);//
}
// render to DIV
obtain_phone_type_grid.render('obtain_phone_type');
}catch(e){alert(e);}
});
/*****************/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值