views:

2037

answers:

6

I am using Ext JS to make a popup window, here is the code:

function popupImage(term, imageNumber){

    if(currentPopupWindow!=null){
        currentPopupWindow.close();
    }

    currentPopupWindow = new Ext.Window({
                layout      : 'fit',
                closeAction :'hide',
                plain       : true,
                constrain   : true,
                width: 300,
                border: false,
                html: "Blah blah content"<span onclick=\"currentPopupWindow.close();\">cerrar</span>"
            });



    currentPopupWindow.show(false, function(){
        var el = Ext.get("termimage");
        currentPopupWindow.setWidth(el.getWidth(true)+150);
    });

    currentPopupWindow.anchorTo(Ext.get("dictionarycontainer"), "tl");
}

In firefox this works fine. In IE7 it works, but always produces a javascript error saying "unspecified error".

What am I doing wrong?

EDIT

Removing the anchorTo line removes the error. I would still like to anchor to though so this isn't a great solution!

A: 

A quick Google search tells me that you're not the only extJS user that is experiencing this. (See here and here and here for three examples.) Best would be to post in their forums so they can either fix their bug or work around an IE7 bug, whichever is the case.

Eddie
A: 

This looks like it has something to do with it, not that I understand..

http://weblogs.asp.net/rajbk/archive/2006/11/29/ie-6-7-unspecified-error-when-accessing-offsetparent-javascript.aspx

qui
+1  A: 

This is the solution, dumb as it is:

Have the same window creation, then instead of the calls to show and anchor to:

    currentPopupWindow.render(document.body);
    currentPopupWindow.alignTo(diccon, "tl", [40, 80]);

                currentPopupWindow.show(false, function() {
            var el = Ext.get(termim);
            currentPopupWindow.setWidth(el.getWidth(true)+150);
        });
qui
A: 

qui is right. The problem lies in anchorTo. Use alignTo and the exception goes away. Sorry qui, tried to "up" your response but were not able to. I don't have any reputation.:)

Athele

A: 

To your second question: Removing the anchorTo line removes the error. I would still like to anchor to though so this isn't a great solution!

Use alignTo and monitor scroll and mousewheel event and update the position accordingly and it is the same as anchorTo. That is the workaround I have found.

Athele

A: 

Try to add:

shim: false

to popup window parameter list.

Thevs