Question

I have some page that should have dynamic count of check boxes, and inputs depends on data received from database

now I do like this:

  1. make rpc call on component load (getting data for inputs)
  2. onSuccess add inputs dynamically on the form

result: form displayed without content(because it makes call async), only after resizing, it displays content properly (probably I can fire resize event or redraw with my self, don't know how.. )

question: I am new in GWT, What is the best way to do this task? (Now i am using gwt-ext http://gwt-ext.com/, but I think it's no matter )

update: to refresh panel it's possible to call doLayout();

Was it helpful?

Solution

I'm not familiar with gwt-ext but in "vanilla" gwt you have two options:

  1. Refresh your widget (that should show the result) in the onSuccess method
  2. Proceed with the rest of your code not until the result returned.

To get a bit more precise i would need more of your code.

OTHER TIPS

I had a similar challenge, the content of my widget was loading for a few seconds. I display a ""Loading, please wait ..."" label until the widget is loaded:

final VerticalPanel mainPanel = new VerticalPanel();

    initWidget(mainPanel); 
    mainPanel.add(new Label("Loading, please wait ..."));
    mainPanel.add(new myCustomWidget()); // this constructor uses RPC to get content

    Timer t = new Timer()
    {
        public void run()
        {
            if (!mainPanel.getWidget(1).isVisible()) { 
                // do nothing
            } else {
                // remove label "Loading, please wait ..."
                mainPanel.remove(0);
                // stop timer
                cancel(); 
            }
        }
    };
    // repeat every 30 miliseconds until myCustomWidget is visible
    t.scheduleRepeating(30); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top