window/Edit.js: query for inputpanel

Because access to item[0] return the config object (not the real object).
This commit is contained in:
Dietmar Maurer 2017-03-28 15:12:22 +02:00
parent 81244aa1fe
commit 1b07a95ac8

View File

@ -3,16 +3,16 @@
Ext.define('Proxmox.window.Edit', { Ext.define('Proxmox.window.Edit', {
extend: 'Ext.window.Window', extend: 'Ext.window.Window',
alias: 'widget.proxmoxWindowEdit', alias: 'widget.proxmoxWindowEdit',
resizable: false, resizable: false,
// use this tio atimatically generate a title like // use this tio atimatically generate a title like
// Create: <subject> // Create: <subject>
subject: undefined, subject: undefined,
// set create to true if you want a Create button (instead // set create to true if you want a Create button (instead
// OK and RESET) // OK and RESET)
create: false, create: false,
// set to true if you want an Add button (instead of Create) // set to true if you want an Add button (instead of Create)
isAdd: false, isAdd: false,
@ -65,7 +65,7 @@ Ext.define('Proxmox.window.Edit', {
} }
} }
}); });
Ext.Array.each(me.query('inputpanel'), function(panel) { Ext.Array.each(me.query('inputpanel'), function(panel) {
panel.setValues(values); panel.setValues(values);
}); });
@ -120,7 +120,7 @@ Ext.define('Proxmox.window.Edit', {
me.hide(); me.hide();
var upid = response.result.data; var upid = response.result.data;
var win = Ext.create('PVE.window.TaskProgress', { var win = Ext.create('PVE.window.TaskProgress', {
upid: upid, upid: upid,
listeners: { listeners: {
destroy: function () { destroy: function () {
@ -204,6 +204,8 @@ Ext.define('Proxmox.window.Edit', {
items: items items: items
}); });
var inputPanel = me.formPanel.down('inputpanel');
var form = me.formPanel.getForm(); var form = me.formPanel.getForm();
var submitText; var submitText;
@ -249,9 +251,9 @@ Ext.define('Proxmox.window.Edit', {
if (me.fieldDefaults && me.fieldDefaults.labelWidth) { if (me.fieldDefaults && me.fieldDefaults.labelWidth) {
colwidth += me.fieldDefaults.labelWidth - 100; colwidth += me.fieldDefaults.labelWidth - 100;
} }
var twoColumn = items[0].column1 || items[0].column2; var twoColumn = inputPanel &&
(inputPanel.column1 || inputPanel.column2);
if (me.subject && !me.title) { if (me.subject && !me.title) {
me.title = Proxmox.Utils.dialog_title(me.subject, me.create, me.isAdd); me.title = Proxmox.Utils.dialog_title(me.subject, me.create, me.isAdd);
@ -263,7 +265,7 @@ Ext.define('Proxmox.window.Edit', {
me.buttons = [ submitBtn, resetBtn ]; me.buttons = [ submitBtn, resetBtn ];
} }
if (items[0].onlineHelp) { if (inputPanel && inputPanel.onlineHelp) {
var helpButton = Ext.create('PVE.button.Help'); var helpButton = Ext.create('PVE.button.Help');
me.buttons.unshift(helpButton, '->'); me.buttons.unshift(helpButton, '->');
Ext.GlobalEvents.fireEvent('pveShowHelp', items[0].onlineHelp); Ext.GlobalEvents.fireEvent('pveShowHelp', items[0].onlineHelp);