Ext.namespace('ext.ptc.part.commpartview') //定义包名
ext.ptc.part.commpartview.setConfigure = function(){ //定义类名称
this.checkboxGroup = new Ext.form.CheckboxGroup({
layout : 'column',
style : 'padding-left:15px;',
items : [{
xtype : 'compositefield',
items : [{
xtype :'checkbox',
id : 'collapsible',
name :'isCollapsible',
inputValue : 'TRUE',
boxLabel :'是否折叠'
}]
},{
xtype : 'compositefield',
items : [{
xtype :'checkbox',
id : 'endItem',
name :'isEndItem',
inputValue : 'TRUE',
boxLabel :'是否顶层部件'
}]
}]
});
this.panel = new Ext.form.FormPanel({
width : 500,
height : 300,
border : false,
style :'padding: 10px 20px 2px 40px;',
border : false,
paramsAsHash : true,
id :'panelConfig',
baseParams : { oid : urlOid },
api :{
load : partToolsController.geItemConfigInfo,
submit : partToolsController.saveItemConfigInfo
},
listeners : {
'render' : function() {
this.getForm().load({
success : function(form, action) {
if(action.result.data.isDynamic == 'TRUE'){
document.getElementById('dynamic').checked = true;
}
},
failure : function(form, action) {
alert('load is failure!')
}
});
}
},
items : [this.checkboxGroup ,{
buttons : [{
text :'保存',
border :false,
handler : function(){
Ext.getCmp('panelConfig').getForm().submit({
clientValidation: false,
success: function(form, action) {
//表单提交成功则
var partURL = action.result.partURL;
var exception = action.result.exception;
//alert(partURL);
if(!Ext.isEmpty(partURL)){
location.href = partURL;
}
}
});
}
}]
}
]
});
//定义构造函数
ext.ptc.part.commpartview.setConfigure.superclass.constructor.call(this,{
region : 'center',
renderTo : Ext.getBody(),
autoHeight : true,
border : false,
items : [this.simple],
scope : this,
items :[this.panel],
listeners : {
'render' : function(){
}
}
});
};
Ext.extend(ext.ptc.part.commpartview.setConfigure ,Ext.Panel,{ //定义继承的父类
//这里定义类的方法
});
//1、调用示例1
var mainContent = Ext.getCmp('centerContent');
mainContent.removeAll();
mainContent.add(new ext.ptc.part.commpartview.setConfigure());
mainContent.doLayout();
//2、调用示例2(完整js文件)
Ext.ns('ext.ptc.viewmain');
Ext.onReady(function() {
this.northMenuItem = new ext.ptc.part.commpartview.setConfigure();
new Ext.Viewport({
xtype : 'panel',
layout : 'border',
autoWidth : true,
border : true,
cls : 'wcshell',
id : "mainpage",
defaults : {
split : true
},
items : [this.northMenuItem]
});
});
//DirectStore
var madstore = new Ext.data.DirectStore(
{
paramsAsHash : true,
baseParams : {
fileJson : '',
replaceOrLeave : '',
partTemplate : Ext.getCmp('id_usag_model').getValue()
},
api : {
read : createUsageLinkController.getUsageLinkFromFile
},
reader : new Ext.data.JsonReader({
fields : [ 'removeFlag', 'uploadPartNumber',
'uploadPartNumberHref', 'description', 'quantity',
'unit', 'lineNumber', 'isMustNeed', 'salePartType',
'isPlanningPart', 'status', 'version', 'occName',
'isLabelPart', 'quotePrice', 'packingABC',
'template', 'hintkMsg', 'isSyncOK']
}),
listeners : {
scope : this,
load : function(p, records, options) {
}
}
});
回复 更多评论