dontide 2009-08-04 16:58
浏览 320
已采纳

Ext window 显示问题

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这个来显示的时候就出现了如图片显示的情况,请问各位知道我为什么会出现这种情况吗?不慎感激。

  • 写回答

2条回答 默认 最新

  • zhoujuan520 2009-08-04 17:03
    关注

    帮你格式化一下,以便查看 [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]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog