PDA

View Full Version : addListner



Cyberangel67
25 Nov 2007, 4:23 PM
Hi guys,

Did a search through here and found nothing.

I have the following code, that works.

jobsSort = Ext.get('jobsSort');
jobsSort.addListener('mouseup', this.handleJobSort);

And the following code that throws an error, y has no properties!!
contactAdd = Ext.get('contactAdd');
contactAdd.addListener('mouseover', this.handleMouseOverContact);

I am not sure what I am actually doing wrong?

hendricd
25 Nov 2007, 4:25 PM
Some code, browser and OS version might be useful /:)

Cyberangel67
25 Nov 2007, 4:52 PM
Some code, browser and OS version might be useful /:)

The OS is not important, as it happens from any machine I browse from. Currently viewing from Firefox, so that I can see what the error is.

This is extJS2.0RC1, and the code that it falls over on is this.

<code>
contactAdd = Ext.get('contactAdd');
contactAdd.addListener('mouseover', this.handleMouseOverContact);
</code>

Like I said it works when doing a click event, but when it its the line addListener above I get the error Y has no properties. So I am confused as to why this is the case?

Cyberangel67
25 Nov 2007, 5:15 PM
Well this seems very strange to me:-)

This code throws an error in extJS2.0 for some reason.

jobsSort = Ext.get('jobsSort');
jobsSort.addListener('mouseover', this.handleJobSort);

And yet the following code works fine:-)

jobsSort.on('mouseover', function(e, item, value){
alert("mouse over);
});

And this throws the same error Y has no properties

jobsSort.on('mouseover', this.handleJobSort);


The element is a normal div tag

<div id="jobsSort"></div>

efege
25 Nov 2007, 5:24 PM
Are you using ext-all.js or ext-all-debug.js? The second one is recommended to ease debugging.

Is your code executed using Ext.onReady? Maybe you are trying to access a DOM node before it is available.

Cyberangel67
25 Nov 2007, 5:38 PM
Yes it is using Ext.onReady.

It does this

Ext.onReadt(ListenerSetup.init,ListenerSetup,true)

The code posted beforer is in the Init function.

tryanDLS
26 Nov 2007, 9:22 AM
Instead of multiple disjointed pieces, please post a complete sample in CODE tags that illustrates the problem.

Cyberangel67
26 Nov 2007, 2:43 PM
I guess because some people are really lazy... There is nothing wrong with any of my other code, and as stated the following will not work and throws an error.

jobsSort = Ext.get('jobsSort');
jobsSort.addListener('mouseover', this.handleJobSort);

The div is just something like this.

<div id="jobsSort">Job Sort Div</div>

Now when line debugging the code I can get as far as this line

jobsSort.addListener('mouseover', this.handleJobSort);

Before an error is thrown - Y has no properties.

the function is

handleJobSort: function(event, el, value) {
console.log("addJobs");
}

The above function is never reached.

I can post anymore than I have as there is IP in the code.

tryanDLS
26 Nov 2007, 2:48 PM
I guess because some people are really lazy...

I think you need to check your attitude. You come here asking for help from an entirely volunteer support community that doesn't owe you anything. Myself and others have already gone thru 200+ new posts today, so you really don't need to call anybody lazy. I don't think it's too much to ask to follow the conventions and post a reasonable example of the issue, in CODE tags, and use ext-all-debug.js so you get a meaningful line number and message.

Cyberangel67
26 Nov 2007, 3:22 PM
How did you come to the conclusion that I was calling you Lazy?