Extjs隐藏某列

如何在动态的修改列的显示和隐藏:
下面为示例代码:
if(matchStatus.getValue()=="weipp"){

colMode=this.getColumnModel();

var handColIndx=colMode.findColumnIndex("match");

colMode.setHidden(handColIndx,false);

}else{

var colMode=this.getColumnModel();

var handColIndx=colMode.findColumnIndex("match");

colMode.setHidden(handColIndx,true);

}

 

 

注意的是:当列当中配置了gridShow : false,的时候,就无法找到列对象了
 可以写在refresh中
调用:
  1. listeners :{
  2. afterrender :function(){
  3. var thisGrid =this;
  4. var colMode = thisGrid.getColumnModel();
  5. var handColIndex = colMode.findColumnIndex('satisfactionName');
  6. if(thisGrid.petitionTypeCode==3){
  7. colMode.setHidden(handColIndex,false);
  8. }else{
  9. colMode.setHidden(handColIndex,true);
  10. }
  11. }
  12. },
 
               
 
 

 





posted @ 2014-07-24 15:00  thero  阅读(1674)  评论(0编辑  收藏  举报