[英]Feedback message in extjs
Here is my requirement: 这是我的要求:
I have a form, with 3 fields. 我有一个表格,包含3个字段。 If user changes the 3rd field to a specific value, I need to reset the 1st field and I want to give a feedback message adjacent to the 1st field with a custom message.
如果用户将第三个字段更改为特定值,则需要重置第一个字段,并且要在第一个字段附近提供带有自定义消息的反馈消息。
I understand there are different kind of Message Box is ExtJS like Prompt, Confirm, OK, Cancel etc. But I just want my message to appear and fade away in 2 seconds automatically. 我知道有不同类型的消息框是ExtJS,如Prompt,Confirm,OK,Cancel等。但是我只想让我的消息在2秒内自动出现并消失。 Can this be achieved using any ExtJS component?
可以使用任何ExtJS组件来实现吗?
I'd recommend using Ext.tip.QuickTip
for something like this. 我建议使用
Ext.tip.QuickTip
的东西。
Ext.create('Ext.tip.QuickTip', {
id: 'myquicktip',
hideDelay: 2000,
header: false
});
Ext.create('Ext.panel.Panel',{
title: 'Panel',
layout: 'hbox',
height: 200,
width: 600,
items: [{
xtype: 'textfield',
id: 'field1',
}, {
xtype: 'textfield',
id: 'field2',
}, {
xtype: 'textfield',
id: 'field3',
listeners: {
change: function(){
var field1 = Ext.getCmp('field1'),
tip = Ext.getCmp('myquicktip');
field1.setValue('');
tip.update('field1 has been cleared');
tip.showBy(field1)
}
}
}
],
renderTo: Ext.getBody()
});
Here is a fiddle link too: https://fiddle.sencha.com/#fiddle/9pd 这也是一个小提琴链接: https : //fiddle.sencha.com/#fiddle/9pd
Depending on how exactly it should look like, I'd use either one of 根据外观的确切程度,我将使用以下任一种
Ext.form.field.Display
Ext.form.Label
Ext.tip.Tip
Ext.tip.QuickTip
They all can be decorated with Ext.util.Animate
mixin, if builtin animations are not animated enough. 如果内置动画的动画效果不够,则可以使用
Ext.util.Animate
mixin装饰它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.