PDA

View Full Version : IE Bug - 'typeIdArray[...]' is null or not an object



sdever98
24 Jul 2008, 8:12 AM
Hi,

I am using GXT v1 and embedding one module into another module using JavaScript. I have included the 2 GWT modules and the HTML file. Mod1 is the main application and Mod2 gets inserted into the Center Panel from Mod1. As soon as you mouse over Center panel you will see a JavaScript error, 'typeIdArray[...]' is null or not an object. This error is causing all kinds of problems in my application (i.e. resizing west/center divider will cause the app to lock up.)

Thanks in advance!

Scott Dever.



// Mod1.html
<html>
<head>
<title>Mod1 Application</title>
<link rel="stylesheet" type="text/css" href="css/ext-all.css"/>
<link rel="stylesheet" href="Mod1.css">
<link rel="stylesheet" href="Mod2.css">
</head>
<body>

<script type="text/javascript" language="javascript" src="com.foo.Mod2.nocache.js"></script>
<script type="text/javascript" language="javascript" src="com.blah.Mod1.nocache.js"></script>

<h1>Mod1 Application</h1>
</body>
</html>



// Mod1.java
public class Mod1 implements EntryPoint {

public void onModuleLoad() {

Window.enableScrolling(false);

final LayoutContainer c = new LayoutContainer();
c.setSize("100%", "500px");
c.setLayout(new BorderLayout());
c.setBorders(true);

final ContentPanel center = new ContentPanel();
center.setHeading("Center");
BorderLayoutData centerData = new BorderLayoutData(Style.LayoutRegion.CENTER);
centerData.setMargins(new Margins(5, 5, 5, 0));
c.add(center, centerData);

ContentPanel west = new ContentPanel();
west.setHeading("West");

final Html html = new Html();
html.setSize("100%", "100%");
center.add(html);

BorderLayoutData westData = new BorderLayoutData(Style.LayoutRegion.WEST, 200);
westData.setMargins(new Margins(5, 5, 5, 5));
Button button = new Button("Add Me");
button.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
displayParameterPage(html.getId());
}
});

west.add(button);

c.add(west, westData);

final DelayedTask task = new DelayedTask(new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
El td = c.el().getParent();
c.setSize(td.getWidth(), td.getHeight());
}
});

Window.addWindowResizeListener(new WindowResizeListener() {
public void onWindowResized(int width, int height) {
task.delay(200);
}
});

RootPanel.get().add(c);
}

private native boolean displayParameterPage(String elementId) /*-{
if ($wnd.jsTestFunction) {
$wnd.jsTestFunction(elementId);
return true;
}

$wnd.alert('function does not exists!');
return false;
}-*/;
}




// Mod2.java
public class Mod2 implements EntryPoint {

public void onModuleLoad() {
setJSFunction();
}

public static native void setJSFunction() /*-{
$wnd.jsTestFunction = @com.fred.client.Mod2::test1(Ljava/lang/String;);
}-*/;

public static void test1(final String elementId) {
RootPanel panel = RootPanel.get(elementId);
if (panel != null) {
com.extjs.gxt.ui.client.widget.button.Button button = new com.extjs.gxt.ui.client.widget.button.Button("Do Stuff!");
button.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
// Do action here!
}
});

panel.add(button);
} else {
Window.alert("Error: Could not find " + elementId + " element in DOM!");
}
}
}

gslender
24 Jul 2008, 1:00 PM
have you looked at the produced JS to see if indeed what you are trying to do with GWT is even possible? - my first thought is that its not, but I'm not 100% on that...