Ext 多模块调用

 
var sm = new Ext.grid.CheckboxSelectionModel({singleSelect:false}); //创建一个复选框。{singleSelect:true}
sm.handleMouseDown = function(grid,rowIndex,key){ //重写父类方法
console.log(grid,rowIndex,key);
};
var colModel = new Ext.grid.ColumnModel([ //创建GridPanel中的列集合。
new Ext.grid.RowNumberer(), //自动编号。
sm, //复选框。
{header:'id',dataIndex:'id',hidden:true}, //这个编号是ds中的创建的id。
{header:'接口名称',dataIndex:'inter_name',240,align:'center'}, //这个编号是ds中的创建的id。
{header:'接口类型',renderer:checker,dataIndex:'inter_opt_type',320,align:'center'}
//renderer: function(arg,arg){checker()}  如果绑定多个则需要这样写。这里是绑定
]);
==============
{header:'接口类型',
renderer:function(val, metadata, record, rowIndex, colIndex, store){
if(val.type == '0'){
sm.selectRow(rowIndex, true);
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h'/>查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h' checked='checked' />充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h'/>添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h'/>修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h'/>删除";
}else if(val.type == '1'){
sm.selectRow(rowIndex, true);
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h' checked='checked' />查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h'/>充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h'/>添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h'/>修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h'/>删除";
}else if(val.type == '2'){
sm.selectRow(rowIndex, true);
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h' />查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h'/>充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h' checked='checked' />添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h'/>修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h'/>删除";
}else if(val.type == '3'){
sm.selectRow(rowIndex, true);
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h' />查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h'/>充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h'/>添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h' checked='checked' />修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h'/>删除";
}else if(val.type == '4'){
sm.selectRow(rowIndex, true);
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h' />查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h'/>充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h'/>添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h'/>修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h' checked='checked' />删除";
}else{
return "<input type='radio' name='"+val.name+"opt_type' value='1' class='ck ckbox_h' />查询 <input type='radio' name='"+val.name+"opt_type' value='0' class='pay ckbox_h'/>充值 <input type='radio' name='"+val.name+"opt_type' value='2' class='add ckbox_h'/>添加 <input type='radio' name='"+val.name+"opt_type' value='3' class='modi ckbox_h'/>修改 <input type='radio' name='"+val.name+"opt_type' value='4' class='del ckbox_h'/>删除";
}
},dataIndex:'inter_opt_type',320,align:'center'}
===========
 
默认选中问题
renderer:function(value, metadata, record, rowIndex, colIndex, store){
function(val){
console.log(val);
// console.log(value); //Object { name="10001", type="4"}
// console.log( metadata);//Object { id=4, css="x-grid3-cell-last ", value="查询QQ号激活", 更多...}
// console.log( record); //Object { phantom=true, id="ext-record-1", data={...}, 更多...}
// console.log( rowIndex);
// console.log(colIndex);
// console.log(store);
//checker()
 
 
 
=============
 
Ext.ns('Ext.a.aUI');
Ext.a.aUI = Ext.extend(Ext.form.FormPanel,{
construct : function(config){
Ext.a.aUI.supperclass.construct.call(this,config);
}
initComponent : function(){
Ext.a.aUI.supperclass.initComponent.call(this);
this.items = [{
id : 'a',
fieldLabel : 'a',
xtype : 'textfield'
},{
id : 'b',
fieldLabel : 'b',
xtype : 'textfield'
}];
this.buttons = [{
text : 'button',
id : 'btn'
}];
}
});
//另外一个页面调用时
new Ext.a.aUI({
renderTo : Ext.getBody()
});
//注册
Ext.reg('aui',Ext.a.aUI );
//注册后就可以使用xtype来调用
new Ext.Panel({
items : [{
xtype : 'aui'
}]
});
//事件 单独写在一起
Ext.a.aAction = Ext.extend(Ext.a.aUI,{
initComponent : function(){
var btn = Ext.getCmp('btn')
this.addListens('click')
}
});
原文地址:https://www.cnblogs.com/holyes/p/2c503f2de1333cc022fca17bb8cabfbd.html