日期:2014-05-16 浏览次数:20357 次
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);} }); /*****************/