var _layerEquipmentGrid = new Ext.grid.EditorGridPanel({
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
height : 300,
width : 505,
// store :
clicksToEdit : 1,
autoExpandColumn : 'name',
tbar : [{
//text: '增加',
icon : 'shared/icons/fam/feed_add.png',
cls : 'x-btn-icon',
tooltip : '增加记录',
handler : function(){
// var m = new baseinfo_member({
// name: '',
// career: ''
// });
alert("您点了增加记录按钮!");
_layerEquipmentGrid.stopEditing();
// baseinfo_store.insert(baseinfo_store.getCount(), m);
_layerEquipmentGrid.getSelectionModel().selectLastRow();
// _layerEquipmentGrid.startEditing(baseinfo_store.getCount() - 1, 0);
}
}, {
//text: '删除',
icon : 'shared/icons/fam/feed_delete.png',
cls : 'x-btn-icon',
tooltip : '删除记录',
handler : function(){
alert("您点了删除记录按钮");
_layerEquipmentGrid.stopEditing();
// baseinfo_store.remove(_layerEquipmentGrid.getSelectionModel().getSelected());
// grid.startEditing(0, 0);
}
}],
columns : [{
id : 'name',
header : "房间名称",
width : 160,
sortable : true,
dataIndex : 'name',
editor : new fm.TextField({
allowBlank : false
})
}, {
id : 'career',
header : "所占比例",
width : 160,
sortable : true,
dataIndex : 'career',
editor : new fm.TextField({
allowBlank : false
})
}],
stripeRows : true
});
var _layerEquipmentPanel = new Ext.Panel({
frame : true,
width : 500,
height : 300,
items : [_layerEquipmentGrid]
});
//添加设备(form)
var _addEquipmentForm = new Ext.FormPanel({
labelAlign : 'left',
autoHeight : true,
width : 513,
frame : true,
title : '设备信息',
items : [{
baseCls : 'x-plain',
bodyStyle : 'padding:5px',
layout : 'column',
items : [{
baseCls : 'x-plain',
columnWidth : 0.5,
labelWidth : 70,
layout : 'form',
defaults : {
width : 170
},
items : [{
fieldLabel : '所属大楼',
xtype : 'textfield',
readOnly : true,
value : '北京大厦',
name : 'buildingName'
}, {
fieldLabel : '设备名称',
xtype : 'textfield',
name : ''
}, {
fieldLabel : '工 厂',
xtype : 'textfield',
name : ''
}]
}, {
baseCls : 'x-plain',
columnWidth : 0.5,
layout : 'form',
labelWidth : 70,
defaults : {
width : 170
},
items : [{
fieldLabel : '设备编号',
xtype : 'textfield',
name : ''
}, {
fieldLabel : '设备类型',
xtype : 'combo',
mode : 'local',
triggerAction : 'all',
editable : false,
value : 1,
name : ''
}, {
fieldLabel : '安装位置',
xtype : 'textfield',
name : ''
}]
}, {
xtype : 'hidden',
value : '3',
name : 'buildingId'
}, {
baseCls : 'c-plain',
layout : 'form',
labelWidth : 70,
columnWidth : 1,
items : [{
fieldLabel : '备 注',
xtype : 'textarea',
width : 410
}]
}]
}, {
items : [{
autoHeight : true,
baseCls : 'x-plain',
layout : 'fit',
items : [_layerEquipmentPanel]
}]
}]
});
//添加分项(window)
var newAddEquipmentWin;
function handleAddEquipmentWin() {
if(!newAddEquipmentWin){
newAddEquipmentWin = new Ext.Window({
applyTo : 'Equipment_window',
title : '添加设备',
layout : 'fit',
width : 530,
plain : true,
items : _addEquipmentForm,
buttons : [{
text : '保存',
handler : function(){
if (_addEquipmentForm.form.isValid()) {
_addEquipmentForm.form.submit({
url : '',
waitMsg : "正在提交表单数据,请稍候......",
failure : function(form, action) {
newAddEquipmentWin.hide();
_addEquipmentForm.getForm().reset();
// buildingStores.load({
// params : {
// start : 0,// 开始数
// limit : 10,// 服务器根据这两个数来处理分页
// forumId : 4
// }
// });
}
});
} else {
Ext.Msg.alert('信息', '请填写完整在提交!');
}
}
},{
text : '取消',
handler : function(){
newAddEquipmentWin.hide();
}
}]
});
}
newAddEquipmentWin.show();
}
我调用handleAddEquipmentWin这个来显示的时候就出现了如图片显示的情况,请问各位知道我为什么会出现这种情况吗?不慎感激。
[b]问题补充:[/b]
谢谢yourgame帮我格示化了代码,我看我自己发的代码都有点头痛。代码就是格示化后的代码,我调用handleAddEquipmentWin这个来显示的时候就出现了如图片显示的情况,请问各位知道我为什么会出现这种情况吗?不慎感激。
帮你格式化一下,以便查看 [url]http://jsbeautifier.org/[/url]
[code="js"]
var _layerEquipmentGrid = new Ext.grid.EditorGridPanel({
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
height: 300,
width: 505,
clicksToEdit: 1,
autoExpandColumn: 'name',
tbar: [{
icon: 'shared/icons/fam/feed_add.png',
cls: 'x-btn-icon',
tooltip: '增加记录',
handler: function () {
alert("您点了增加记录按钮!");
_layerEquipmentGrid.stopEditing();
_layerEquipmentGrid.getSelectionModel().selectLastRow();
}
},
{
icon: 'shared/icons/fam/feed_delete.png',
cls: 'x-btn-icon',
tooltip: '删除记录',
handler: function () {
alert( & quot;您点了删除记录按钮 & quot;);
_layerEquipmentGrid.stopEditing();
}
}],
columns: [{
id: 'name',
header: "房间名称 & quot;,
width: 160,
sortable: true,
dataIndex: 'name',
editor: new fm.TextField({
allowBlank: false
})
},
{
id: 'career',
header: "所占比例 & quot;,
width: 160,
sortable: true,
dataIndex: 'career',
editor: new fm.TextField({
allowBlank: false
})
}],
stripeRows: true
});
var _layerEquipmentPanel = new Ext.Panel({
frame: true,
width: 500,
height: 300,
items: [_layerEquipmentGrid]
});
//添加设备(form)
var _addEquipmentForm = new Ext.FormPanel({
labelAlign: 'left',
autoHeight: true,
width: 513,
frame: true,
title: '设备信息',
items: [{
baseCls: 'x-plain',
bodyStyle: 'padding:5px',
layout: 'column',
items: [{
baseCls: 'x-plain',
columnWidth: 0.5,
labelWidth: 70,
layout: 'form',
defaults: {
width: 170
},
items: [{
fieldLabel: '所属大楼',
xtype: 'textfield',
readOnly: true,
value: '北京大厦',
name: 'buildingName'
},
{
fieldLabel: '设备名称',
xtype: 'textfield',
name: ''
},
{
fieldLabel: '工 厂',
xtype: 'textfield',
name: ''
}]
},
{
baseCls: 'x-plain',
columnWidth: 0.5,
layout: 'form',
labelWidth: 70,
defaults: {
width: 170
},
items: [{
fieldLabel: '设备编号',
xtype: 'textfield',
name: ''
},
{
fieldLabel: '设备类型',
xtype: 'combo',
mode: 'local',
triggerAction: 'all',
editable: false,
value: 1,
name: ''
},
{
fieldLabel: '安装位置',
xtype: 'textfield',
name: ''
}]
},
{
xtype: 'hidden',
value: '3',
name: 'buildingId'
},
{
baseCls: 'c-plain',
layout: 'form',
labelWidth: 70,
columnWidth: 1,
items: [{
fieldLabel: '备 注',
xtype: 'textarea',
width: 410
}]
}]
},
{
items: [{
autoHeight: true,
baseCls: 'x-plain',
layout: 'fit',
items: [_layerEquipmentPanel]
}]
}]
});
//添加分项(window)
var newAddEquipmentWin;
function handleAddEquipmentWin() {
if (!newAddEquipmentWin) {
newAddEquipmentWin = new Ext.Window({
applyTo: 'Equipment_window',
title: '添加设备',
layout: 'fit',
width: 530,
plain: true,
items: _addEquipmentForm,
buttons: [{
text: '保存',
handler: function () {
if (_addEquipmentForm.form.isValid()) {
_addEquipmentForm.form.submit({
url: '',
waitMsg: "正在提交表单数据,请稍候...... & quot;,
failure: function (form, action) {
newAddEquipmentWin.hide();
_addEquipmentForm.getForm().reset();
}
});
} else {
Ext.Msg.alert('信息', '请填写完整在提交!');
}
}
},
{
text: '取消',
handler: function () {
newAddEquipmentWin.hide();
}
}]
});
}
newAddEquipmentWin.show();
}
[/code]
从你描述的内容来看,我并不知道你在哪里调用了这个方法.请把代码提供完整,以及图片截图截范围大一点,图片我也看不出所以然,你刚好截这么宽,那到底是这个图片中的两个窗体是重叠呢(一个上一个下) 还是一个窗体包含了另一个窗体.我无从得知