-
19 Jun 2009 4:10 AM #1
Clearable button for datefield
Clearable button for datefield
I would like to add clearable button to datefield (I think it should have it by default). I tried like this, it works, but positioning is not ok. Is tehere some other solution?
Code:<html> <head> <script type="text/javascript"> Ext.onReady(function() { var datefield = new Ext.form.DateField({ width: 220, fieldLabel: 'Date', name: 'date', id: 'date1' }); datefield.render('datefield'); var clearableField = new Ext.form.TriggerField({ triggerClass: "x-form-trigger x-form-clear-trigger", emptyText: "", value: "" }); clearableField.onTriggerClick = function() { this.reset(); }; clearableField.applyToMarkup(datefield.id); }); </script> </head> <body> <div id="datefield"></div> </body> </html>
-
19 Jun 2009 4:21 AM #2
Look at the source for TwinTriggerField, there's no "triggerClass".
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
19 Jun 2009 4:29 AM #3
I think TriggerField should be done away with.
TwinTriggerField should be the base class for all fields which show a dropdown on click of a trigger.
The prototype should contain
So that it defaults to looking like a regular single-trigger TriggerField.Code:trigger2Class: 'x-hide-display',
The onTriggerClick and triggerClass function/class name should just be aliases for onTrigger1Click and trigger1Class.
This would save code, and make it easy to add extra trigger functionality to existing TriggerField subclasses.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Jun 2009 4:34 AM #4
Our SelectField subclass has a second trigger. Receiving depot and Destination depot:
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Jun 2009 4:37 AM #5
While we're talking about it, TwinTriggerField (Let's forget about TriggerField) needs two more configs:
Code:trigger1Tooltip: 'Click to see selection list', trigger2Tooltip: 'Click to clear selection'
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Jun 2009 6:07 AM #6
solved
solved
I have borrowed a code from "Ext.ux.TwinCombo"
Simon, have funPHP Code:Ext.onReady(function() {
var trigger = new Ext.ux.TwinDateField({
width: 120,
name: 'date',
value: Ext.get('datum').getValue(),
trigger1Class:'x-form-clear-trigger',
trigger2Class:'x-form-date-trigger',
onTrigger1Click: function() {
trigger.setValue('') ;
}
});
trigger.applyToMarkup('datum');
});
Ext.ux.TwinDateField = Ext.extend(Ext.form.DateField, {
initComponent: function() {
this.triggerConfig = {
tag:'span', cls:'x-form-twin-triggers', cn:[
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
]};
Ext.ux.TwinDateField.superclass.initComponent.call(this);
},
getTrigger: Ext.form.TwinTriggerField.prototype.getTrigger,
initTrigger: Ext.form.TwinTriggerField.prototype.initTrigger,
onTrigger2Click: Ext.form.DateField.prototype.onTriggerClick,
trigger1Class: Ext.form.DateField.prototype.triggerClass
});
-
3 Aug 2010 11:40 PM #7
-
4 Aug 2010 12:51 AM #8
Do a forum search for TwinTriggerCombo
Someone even posteda fix on the TwinTriggerCombo thread yesterday.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
4 Aug 2010 1:01 AM #9
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
4 Aug 2010 1:09 AM #10
thanks for ur fast reply..
is that possible to create in ext 2.3 ?Thanks
_pipiet_


Reply With Quote
