extjs 动态radio创建

 

Njyxfz..totalPro = '';
Njyxfz..root = '';

Njyxfz..checkUnit = function(radio,b){
  for (var i = 0; i < Njyxfz..totalPro; i++) {
       var rd = Ext.getCmp('Njyxfz..zhIndex'+i);
       if(radio.id != rd.id&&b){
            rd.setValue(false);  //只能有一个选中
       }
     if(radio.id == rd.id&&b){  //加载grid数据
           var zhIndexCode = radio.inputValue;
           var grid = Ext.getCmp('Njyxfz..grid');
           Ext.apply(grid.store.baseParams, {
               zhIndexCode: zhIndexCode
          });
        grid.store.load(radio.inputValue);
   }
  }
}

Njyxfz..mainPanel = function(baseIndexDefinitionId, middleIndexId, year, reportType,processId,baseIndexDefIdYouxfzl,baseIndexName){
 var searchTbar = [];
 var params = {baseIndexDefinitionId: baseIndexDefinitionId};
 compositeIndexDWRFacade.getZhfxIndexNames('','','','','root','totalProperty','',params,function(data){
  Njyxfz.totalPro = data.totalProperty;
  Njyxfz.root = data.root;
  for(var i=0;i<data.totalProperty;i++){
      var zhIndex = new Ext.form.Radio({
          id:'Njyxfz.zhIndex'+i,
         boxLabel: data.root[i]['zhfxIndexName'],
         name:'zhIndex',
         checked:false,
         inputValue:data.root[i]['zhfxIndexName'],
         listeners:{
             check:Njyxfz.checkUnit
         }
      }); 
     if(i==0){
       zhIndex.checked=true;
     }
   searchTbar.push(zhIndex,'&nbsp;&nbsp;');
  }
  
  var mainPanel = new Ext.Window({
         id: 'Njyxfz.win',
         title:baseIndexName,
         iconCls: 'p-chart-icon',
         //height: 225,
         width: 800,
         autoHeight:true,
         labelAlign: 'right',
         buttonAlign: 'right',
         modal: true, //True 表示为当window显示时对其后面的一切内容进行遮罩
         constrain: true, //True 表示为将window约束在视图中显示,false表示为允许 window在视图之外的地方显示(默认为 false)
        border:false,
         items: [{
             items: [Njyxfz.gridPanel(searchTbar,baseIndexDefinitionId, middleIndexId, year, reportType,processId,baseIndexDefIdYouxfzl)]
         },{
             layout: 'column',
             bodyStyle: 'width:100%',
             border: false, 
             frame: true,
             labelAlign: 'right',
             items: [{
                 columnWidth: .8,
                 border: false,
                 items: [{}]
              }, {
                 columnWidth: .1,
                 border:false,
                 items: [{
                     text: '&nbsp;&nbsp;&nbsp;&nbsp;保存&nbsp;&nbsp;&nbsp;',
                     xtype: 'button',
                     handler: Njyxfz.saveBtnFun  //按钮保存事件
                 }]
             }, {
                 columnWidth: .1,
                 border: false,
                 items: [{
                     text: '&nbsp;&nbsp;&nbsp;&nbsp;关闭&nbsp;&nbsp;&nbsp;',
                     xtype: 'button',
                     handler: function(){
         //Ext.Msg.confirm('温馨提示','您要保存数据吗?',function(e){
               //   if('yes'==e){
       //    Njyxfz.saveBtnFun();
                        //      Ext.getCmp('Njyxfz.win').close();
       //  }else{
           Ext.getCmp('Njyxfz.win').close();
       //  }
       //  });
                     }
                 }]
             }]
         }]
     });
  
  mainPanel.show();
       
  });
   
}

 

 

你可能感兴趣的:(function,layout,ExtJs,border,button)