View Full Version : Nothing happens :)
Hi,
Any ideas what I might be overlooking? I'm trying to create a border layout by using the exact sample code distributed with GXT (BorderLayoutPage).
My compiled javascript file is about 900 KB, and the compile gives no errors. But the page is entirely blank.
I tried adding the viewport to the RootPanel, but that has no effect. I also tried adding a label to the RootPanel, and this appears fine.
I confirmed that onModuleLoad() and onRender() are both invoked.
Thanks,
-dennis
Did you ad the resources in your HTML file? If no, add this code in the <HEAD> section of your html file
<link rel="stylesheet" type="text/css" href="css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="css/gxt-all.css" />
<link class="gray" rel="stylesheet" type="text/css"
href="css/xtheme-gray.css" />
<link class="gray" rel="stylesheet" type="text/css"
href="css/gxt-all-gray.css" />
Solved the same behaviour in my case.
Lars
Yeah, I have the CSS referenced and it does respond correctly with CSS for these four URLs.
I have altered the URLs, however, in order to get them served from an existing application that I have to compete for "URL space" with.
Don't know if that might cause some problems if the CSS references are used for something directly from javascript. But I can hardly imagine that...
-dennis
Mike M
04-25-2008, 03:21 PM
I am also getting a blank page when I first try to run the shell script. No errors on compile or at run-time. Have added the 4 link lines to the head section of the HTML file. I have tried a couple installations on two different PCs but still the blank page.
I actually got it working now. It turned out to be necesarry to set a size for the panel or something. I had assumed that the "FitLayout" would make the layout fille the whole window, but apparently that didn't work.
Try messing with the sizes, and the layout stuff. I could send you my working EntryPoint class, if you wish.
(Now I'm having trouble with getting a TreeViewer/Tree to display anything beyond the first level, even though I'm pretty sure I'm providing some children asynchronously as per the sample code... Hmm...)
-dennis
Mike M
04-25-2008, 04:01 PM
Hmm, I had started from one of the examples also, which used "extends Container" on the class declaration, but it showed the blank page before. Now, basically, I just reduced it to about the simplest page I could without the "extends Container", but then had to add the line "RootPanel.get().add(viewport);" to the end of my onModuleLoad() method and it now displays. Here's my minimal code:
package com.myapp.client;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.widget.Button;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class MyGwtUi implements EntryPoint
{
public void onModuleLoad()
{
// here we create our viewport and assign the border layout
Viewport viewport = new Viewport();
viewport.setLayout(new BorderLayout());
// west region
// we create a new layout data for the west region and give it a width, min width, and max width
BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 125, 0, 200);
// create the child widget and add it to the container with the layout data
ContentPanel west = new ContentPanel();
west.setTitle("Testing");
west.add(new Button("Hello!"));
viewport.add(west, data);
viewport.layout();
RootPanel.get().add(viewport);
}
}
Mike M
04-25-2008, 05:03 PM
Yep, I see what you mean, I tried the BorderLayout but had to set the size manually also (otherwise it must have defaulted to 0 width and height).
this.setSize("800px", "700px");
Though this works, I would still like to have the window resize automatically to the size of the browser window. How does this work in the demos?
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.