0
我們在liferay portlet中創建了一個Ext.form.panel。它是一個簡單的電子郵件,密碼文本框和保存按鈕。當我們最小化和恢復liferay portlet時。 Extjs表單元素呈現兩次。in liferay最小化和恢復portlet呈現兩次表單面板
請有人幫我解決這個問題。
在此先感謝。
<div id="configPanel"></div>
<script type="text/javascript">
Ext.onReady(function() {
var addUserForm = Ext.create('Ext.form.Panel', {
renderTo: "configPanel",
bodyStyle: 'padding: 5px 5px 0 5px;',
defaults: {
xtype: 'textfield',
anchor: '100%',
},
items: [{
xtype: 'textfield',
name: 'url',
alias:'ac-url',
id:'ac-field-url',
itemId:'configPortlet_URL',
fieldLabel: 'URL',
labelSeparator:'',
allowBlank: false,
vtype: 'url',
emptyText:'[Required e.g. http://google.com]',
listeners: {
//specialkey: submitOnEnter
}
},{
xtype: 'textfield',
name: 'password',
alias:'ac-password',
id:'ac-field-password',
fieldLabel: 'Password',
labelSeparator:'',
inputType: 'password',
allowBlank: false,
enforceMaxLength: true,
maxLength: 256,
emptyText: '[Required]',
listeners: {
//specialkey: submitOnEnter
}
}, {
xtype: 'button',
text: 'Random',
tooltip: 'Generate a random password',
style: 'margin-left: 4px;',
flex: 0,
handler: function() {
//this.prev().setValue(password(8, false));
//this.prev().focus()
}
}],
buttons: [{
id: 'saveBtn',
itemId: 'saveBtn',
text: 'Submit',
handler: function() {
this.up('form').getForm().submit();
}
},{
text: 'Cancel',
handler: function() {
this.up('form').getForm().reset();
}
}],
submit: function() {
var currentForm = this.owner.form;
if (currentForm.isValid()) {
// var newSomething = Ext.create('Something', currentForm.getFieldValues());
}
}
});
addUserForm.show();
});
</script>