PDA

View Full Version : why "Enter" key is not equal to e.ENTER,PLZ do me a favor



iori0758
17 Jan 2011, 6:49 PM
buildForm : function() {//This is a combo
return [

{
store: new Ext.data.SimpleStore({
fields: ['dataFieldName', 'displayFieldName'],
data: [['??100%?COTTON','??100%?COTTON'],['????100%??POLYESTER','????100%??POLYESTER'],['?A?100%?COTTON','?A?100%?COTTON'],['?B?95%?COTTON,5%??LYCRA','?B?95%?COTTON,5%??LYCRA'],['????100%??POLYESTER','????100%??POLYESTER'],['??? 100%??POLYESTER','??? 100%??POLYESTER'],['95%??? MODAL','95%??? MODAL'],['5%?? LYCRA','5%?? LYCRA'],['??? 100%??POLYESTER','??? 100%??POLYESTER']],
autoLoad: false
}),
id: 'elementId',
name: 'element',
fieldLabel: '??',
displayField: 'displayFieldName',
valueField: 'dataFieldName',
blankText:"?????",
emptyText:"??????",
typeAhead: true,

forceSelection: false,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
editable: true,
xtype: 'combo',
anchor:'95%',
listeners:{
specialkey: function(obj, e){
alert(e.getKey());//return 13
alert(e.ENTER);//return 13 too
alert(Ext.EventObject.ENTER);//return 13 too
alert(e.getKey()==e.ENTER);//return false;I don't get it ,why it is false,Some one can explain it ,Sorry for my bad english,
alert(e.getKey()==Ext.EventObject.ENTER);
if (e.getKey()==e.ENTER) {
alert('aaa');
if(!Ext.getCmp("userform").getForm().getValues()){
Ext.getCmp("userform").fireEvent('create', this, Ext.getCmp("userform").getForm().getValues());
alert('aaa');
Ext.getCmp("userform").getForm().reset();
}
}
}
// obj.begin
}
}
];
},