ExtJs的resultGrids中动态添加按钮

var resultGrids = Ext.getCmp("resultGrid");
  resultGrids.getView().on("refresh",doRefresh);

 

//添加查看按钮
 var doRefresh = function(view) {
  //alert("99999");
  for(var i = 0; i   {
   for(var j = 0;j < view.cm.config.length;j++){
    
    
    if(view.cm.config[j].id=="handler"){
     //获取单元格button对象
     //alert("888");
     var cell = view.getCell(i,j);
     var bid = Ext.id();  
          cell.innerHTML ='

';
      var button=new Ext.Button({
       text:"查看",
       renderTo:bid,
       id:bid,
       record:view.ds.getAt(i) ,
       handler:checkSon       
      });      
     
    }
   }
  }  
 }

 

 

function checkSon() {
         var checkId = this.record.get('checkId');
   //alert(checkId);
   //var url='/op/aget/commercialpos_out.jsp?posId='+encodeURI(encodeURI(posId));
   var url='/op/shanghu/sub_shanghu_update.jsp?checkId='+checkId;
   app.getPortal().contMgr.switchContent(url,true);
   
        };

 

 

 

 

你可能感兴趣的:(js)