PDA

View Full Version : Datefield select event not working



nikhilkrishnan
21 Jul 2010, 10:31 PM
This is the third time i'm posting it. I don't what to write to impress the moderators.

This is really frustrating first of all the forum search is not working properly i have reported about this, now after spending a lot of time searching i have posted the issue two time and its says i have to wait for the moderators approval.

Yes this is a good move but if the forum search was good i don't have to post this and waiting for the approval.

Any Here is my issue .

This select event is not working for the datefield



closed_date = new Ext.form.DateField({
id:'closed_date',
fieldLabel: 'Closed Date',
format : 'd-m-Y',
value:date_value,
listeners: {
select: function(){
Ext.Ajax.request({
url : base_root+'somepage.php',
params : {
task: 'Existence_OF_Rejected_bill',

bond_date:closed_date.getValue().format('Y-m')

},

failure:function(response,options){
Ext.MessageBox.alert('Warning','Oops...');
},
success:function(response,options){
var json = Ext.util.JSON.decode(response.responseText);

if(json.count==1){
Ext.MessageBox.alert('Sorry','msg');
Ext.getCmp('repaybutton').disable();


}else{
Ext.getCmp('repaybutton').enable();
}
returnstatus=1;
}
});

}
}
});
Please approve this
Nikhil

Condor
21 Jul 2010, 10:54 PM
Define 'not working'...

(the select event is only fired when you select a date from the menu - not when you enter a date using the keyboard)

nikhilkrishnan
21 Jul 2010, 11:00 PM
Yes the the user is selecting the date using the trigger button not entering from the keyboard. And i forgot mention this I'm using extjs 2.2.

Is it possible to use the datepickers select event with the datefield?

Thank you very much condor for quick replay .

Animal
21 Jul 2010, 11:03 PM
It's a fairly routine, mechanical job to upgrade to 3.3.2

There are a lot of fixes, so the best thing would be for you to upgrade.

Condor
21 Jul 2010, 11:06 PM
In Ext 2.2 DateField didn't have a 'select' event (did you look at the Ext 2.2 API docs?).

If you don't want to upgrade you'd have to use:

var df = new Ext.form.DateField({
...
menuListeners: Ext.applyIf({
select: function(menu, value){
Ext.form.DateField.prototype.menuListeners.select.call(this, menu, value);
// do stuff
}
}, Ext.form.DateField.prototype.menuListeners)
});

nikhilkrishnan
21 Jul 2010, 11:11 PM
"In Ext 2.2 DateField didn't have a 'select' event (did you look at the Ext 2.2 API docs?)."

Yes I did thats why i edited the post and added the version, i was looking at 3.2.1 API docs I can't upgrade the version so I will try your code .

Again thank you very much condor

nikhilkrishnan
21 Jul 2010, 11:17 PM
OMG it worked !

A million thanks Condor You are a genius. How do you know all this stuff ?

Animal
21 Jul 2010, 11:21 PM
By reading the code. Anybody can do it.

nikhilkrishnan
21 Jul 2010, 11:31 PM
Nice point Animal..

but config option 'menuListeners' is not in 2.2 API docs how i'm suppose to know about it?

I got the docs from here

http://extjs.edspencer.net/extjs/docs/output/Ext.form.DateField.html

Animal
21 Jul 2010, 11:58 PM
By reading the code.

Condor
22 Jul 2010, 12:06 AM
And by having a good memory. I've been using Ext since 2006 (yui-ext 0.3).

nikhilkrishnan
22 Jul 2010, 12:29 AM
:D Thank you condor and Animal for the right kind of support . I usually go through the API docs before creating any forms with the extjs, and usually uses google [stopped using extjs.com search].Is there any other sites that i should visit to learn these kinds of stuffs?

Animal
22 Jul 2010, 12:46 AM
The "src" directory of your ExtJS SDK!

ashwin.parmar
26 Oct 2012, 2:21 AM
Thanks for Select Event fire on Date field.