PDA

View Full Version : Updater - Problem with callback in IE



Cubaza
25 Mar 2011, 8:49 AM
Hi,
I have some problems with using callback in IE.
On my page I'm using callback and updater. When I'm running function in callback by Firefox, Chrome and, safari it works. When i want to run it on IE, it doesn't run it. On other browsers than IE i see console.logs from this function.
Is anyone have the same problem with it? I'll be very glad if someone can help me to resolve this problem.

P.S. Sorry for my English

fay
25 Mar 2011, 9:12 AM
Have you run your code through www.jslint.com (http://www.jslint.com)? When it works on FF and not IE, the problem could be a trailing comma... jslint will flag any such problems.

Cubaza
25 Mar 2011, 11:47 AM
My code in callBack looks like this:


newsPortlet.getUpdater().update({
url: target,
method: 'GET',
scripts: true,
callback: function() {
if (Ext.get('mediaDetailsLinkId') != null)
{
Ext.get('mediaDetailsLinkId').addListener('click', mediaDetailsClickEvent, this {stopEvent:true});
}
Ext.get('newsBackLinkId').addListener('click', newsBackToChannel, this, {stopEvent: true});
if (Ext.get('likeButtonId') != null)
{
Ext.get('likeButtonId').addListener('click', newsLikeClickEvent, this, {stopEvent: true});
Ext.get('dislikeButtonId').addListener('click', newsDislikeClickEvent, this, {stopEvent: true});
}
}
});

When i want to run it on www.jslint.com i need to paste whole code of my page. When i paste it there it gives me many errors like this:
Expected '!==' and instead saw '!='. All of these statements are good, but your page gives me these errors.
Other error is like this:

Expected '{' and instead saw 'target'.
when the function looks like this:

if (e != null && typeof(e) != 'undefined')
target = e+'?ajax=true';
So I think it isn't a error.
I don't tell that your page is bad, but i think in my case these errors aren't a problem.

And i don't know how resolve my problem. If enyone knows where i need to look to resolve this problem :(

johnathanhebert
25 Mar 2011, 1:30 PM
Seems like the error is that you are missing a comma after the third argument in the first addListener call:


newsPortlet.getUpdater().update({
url: target,
method: 'GET',
scripts: true,
callback: function() {
if (Ext.get('mediaDetailsLinkId') != null)
{
Ext.get('mediaDetailsLinkId').addListener('click', mediaDetailsClickEvent, this, {stopEvent:true});
}
Ext.get('newsBackLinkId').addListener('click', newsBackToChannel, this, {stopEvent: true});
if (Ext.get('likeButtonId') != null)
{
Ext.get('likeButtonId').addListener('click', newsLikeClickEvent, this, {stopEvent: true});
Ext.get('dislikeButtonId').addListener('click', newsDislikeClickEvent, this, {stopEvent: true});
}
}
});

Cubaza
26 Mar 2011, 7:07 AM
Hi, thanks a lot for a replay, but problem isin't there. I have this comma in my function. I don't know why it wasn't in code that i paste in my last answer.

fay
26 Mar 2011, 8:09 AM
You can use Firebug Lite (http://getfirebug.com/firebuglite) on IE to help debug it (or the in-built IE "Tools | Developer Tools"). Btw, www.jslint.com (http://www.jslint.com) is not my page, but I seriously recommend that you use it to deal with warnings/errors - I find it invaluable for tracking down IE-specific problems.