PDA

View Full Version : KeyMap function



dkb83
8 Apr 2008, 12:26 AM
Hi, I am a new user of Extjs.

I found that KeyMap function is very useful in the API Doc, but when i tried to use the code that the Document mention:

var map = new Ext.KeyMap("my-element", {
key: 13, // or Ext.EventObject.ENTER
fn: myHandler,
scope: this
});

function myHandler(){
alert("Test");
};
the following error returns:
this.el has no properties

do I need to set somthing else to make it activate?

evant
8 Apr 2008, 12:32 AM
1) Is your code wrapped in an onReady block?
2) Do you have an element on your page with an id of 'my-element'?

dkb83
8 Apr 2008, 12:50 AM
1) Is your code wrapped in an onReady block?
2) Do you have an element on your page with an id of 'my-element'?
oh i forget to change the second statement, it's okay now, thanks a lot!