PDA

View Full Version : Is there any to add a listener to the filter date property



tsensuous.grace
21 Jun 2016, 10:39 PM
I have a date filter that I want to add a listener to, something like:


fields: [{
filter: {
xtype: 'superdate-search-field',
fieldLabel: 'Date',
listeners: {
change: function(event) {
//stuff here
},
scope: this
}
}
}]

the above code is not working for me. Is there a way I can add a listener function to do stuff after the date filed is instantiated?
Thanks

jdkhamba
22 Jun 2016, 3:45 AM
Aer you talking about grid column filters? If so, these are the only events available:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.ux.grid.filter.DateFilter-cfg-listeners

I am not sure why you would need to have a listener on the filter though.

tsensuous.grace
22 Jun 2016, 12:19 PM
Well this filter is more of a dropdown search field.something like attached.
I basically want to do stuff when a search filter is instantiated, like hide few dropdown options.
It instantiates where I have my listeners mentioned. Not sure if the one listed in the comment would be helpful...js:


$cls.superclass.constructor.call(this, Ext.apply({
directFn: this.getData,
fields:[{
name: 'date',
type: 'date',
filter: {
type: 'string',
xtype: 'superdate-search-field',
fieldLabel: 'Event Date'
listeners: {
selectionchange: function(sm) {
debugger;
},
scope: this
}
}
}] [{

jdkhamba
22 Jun 2016, 1:14 PM
xtype: 'superdate-search-field'

What is this exactly? Which ExtJS component does it extend from ?

tsensuous.grace
22 Jun 2016, 1:27 PM
Ext.form.TwinTriggerField


Ext.extend($cls, Ext.form.TwinTriggerField, {

initComponent : function() {
}

});

jdkhamba
22 Jun 2016, 1:46 PM
This is never going to work. There are just too many things that are wrong. Take a look at the docs:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.form.field.Trigger

There is no such thing as "directFn" or "fields" or any of that in the configs. Moreover,
this syntax:


$cls.superclass.constructor.call(this, Ext.apply({

Was more prevalent in Ext 3.x , there is no need to code like that if you are using Ext 4.x,also since there are no configs called "fields", none of it is actually getting applied to $cls.



listeners: {
selectionchange: function(sm) {
debugger;
},
scope: this
}


There is no selectionchange event, although there is a change event. But none of that is going to get applies as the configs are all wrong and not getting applied.