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) {
}
}
});
回复