如何在ExtJS中重置文件字段输入?我在尝试:
//this - point on Ext.panel.Form
var form = this.getForm();
form.reset();
var filefield = this.getForm().getFields().get(0);
filefield.reset();
filefield.setValue('');
filefield.value = '';
Run Code Online (Sandbox Code Playgroud)
但这些方法中没有一种不起作用.谢谢你的帮助!
我尝试编写方法,为窗体上的所有字段设置readOnly属性.
我的代码:
Ext.override(Ext.form.Panel,{
setReadOnlyForAll: function(bReadOnly) {
this.cascade(function(f) {
if (f.isFormField) {
f.setReadOnly(bReadOnly);
}
});
});
Run Code Online (Sandbox Code Playgroud)
从Ext.form.Panel调用此方法:
this.setReadOnlyForAll(false);
Run Code Online (Sandbox Code Playgroud)
但这种方法工作得很慢.有人知道如何提高速度吗?谢谢!
美好的一天!我尝试在没有ajax的情况下提交extjs表单并在下一页显示结果.这是我的代码:
Ext.define('test.from', {
extend: 'Ext.form.Panel',
alias: 'widget.test.form',
initComponent: function () {
var me = this;
Ext.apply(this, {
frame: true,
bodyPadding: 7,
border: 0,
items: [{
xtype: 'textfield',
fieldLabel: 'First Name',
name: 'contact_attr'
}, {
xtype: 'textfield',
fieldLabel: 'Last Name',
name: 'contact_attr'
}],
buttons: [{
text: 'Send',
handler: function () {
me.getForm().submit({
url: '/salary/public/auth/',
standardSubmit: true,
method: 'POST'
});
}
}]
});
Run Code Online (Sandbox Code Playgroud)
但是没有发生重定向到其他页面,我收到错误:You're trying to decode an invalid JSON String.有谁能够帮我?谢谢!
我需要在字段(组合框,*日期*等)上隐藏/显示触发器而不需要调用方法doComponentLayout()(setReadOnly方法的源代码).方法doComponentLayout()在IE上非常慢.有谁能够帮我?谢谢!