Hi!

The problem is that in your function "public void showUsers() {" you
create a entry into FlexTable for each user, including the non-visible
ones.

Some browsers have problems displaying a huge data.

To solve this you have 2 options:

Create some kind of pagination into your flextable, creating a set of
your users and display only the possible visible ones(Something like
50), and remove/add the users as the user navigate through it.

Other option as Tom Hjeliming said, is to use some framework like
SmartGWT(http://code.google.com/p/smartgwt/). SmartGWT have a lot of
features and Widgets that makes life easier.
One of them is the Live Grid(http://www.smartclient.com/smartgwt/
showcase/#featured_grid_live), in the example it have around 700
records, but only render the visible ones, so it runs smooth on IE and
Firefox.

SmartGWT can load only a partial set of the data and ask server for
more when needed or load everything, depends on your requirement.

Regards

On Jun 11, 2:13 pm, Tom Hjellming <[email protected]>
wrote:
> Hi Joe,
>
> The trick is to not even try to load that much data into the browser.  
> We use the SmartGWT widget library which has very good support for
> virtual pagination of lists and comboboxes.  By default, it only loads
> the first 75 rows and then as the user scrolls down, calls are made back
> to the server to retrieve the desired data - which is then shown to the
> user.  There is an occasional delay when the user sees blank space which
> is then filled in when the data comes in.  But overall, it is a great
> solution -we're viewing tables with thousands of rows and seeing better
> performance than our old Swing-based application.
>
> Tom
>
>
>
> Joe Larson wrote:
> > I am having a performance problem.  I am trying to build a page that
> > allows the user to select from a fairly large list of objects (up to
> > 20,000).  We have filtering capabilities to trim the list so the user
> > doesn't have to scroll through all of them.  It's a reasonable UI.
>
> > Unfortunately, I only get decent performance on Safari.  IE6 is
> > exceptionally miserable.  It's okay when the list has 100 items, but
> > it crashes as we exceed 300.  So I've been experimenting, and I
> > haven't found a way around it.
>
> > So I created a sample app.  All I did was populate an
> > ArrayList<String> with 20,000 fairly short strings that I read out of
> > the HTML file.  Under Safari 4 on a G5 Mac Pro, this is almost
> > instant.  Under IE6 on a similar age Windows box, it's taking 4
> > minutes.  Firefox on the G5 runs out of memory.
>
> > Is it possible to store large amounts of data in my GWT applications?
> > Or do I have to store fairly small amounts of data and go back and
> > forth to the server a lot?  If it's the latter, I may as well just go
> > back to what we used to do (WebObjects).
>
> > I'm including my little sample program.  Maybe there's something
> > obvious that I can do?
>
> > -Joe
>
> > --- GWTMinimum.java ---
> > package com.missionmode.gwtminimum.client;
>
> > import java.util.*;
>
> > import com.google.gwt.core.client.*;
> > import com.google.gwt.user.client.*;
> > import com.google.gwt.user.client.ui.*;
>
> > /**
> >  * Entry point classes define <code>onModuleLoad()</code>.
> >  */
> > public class GWTMinimum implements EntryPoint {
> >    public FlexTable                        panel;
> >    public Button                           loadBtn;
> >    public Button                           displayBtn;
> >    public ListBox                          listBox;
> >    public Label                            label;
> >    public ArrayList<String>  usernames = new ArrayList<String>();
> >    public String[] parts;
>
> >    /**
> >     * This is the entry point method.
> >     */
> >    public void onModuleLoad() {
> >            panel = new FlexTable();
> >            RootPanel.get("web2").add(panel);
>
> >            loadBtn = new Button("Click to start load");
> >            panel.setWidget(0, 0, loadBtn);
>
> >            loadBtn.addClickListener(new ClickListener() {
> >                    public void onClick(Widget sender) {
> >                            loadUsers();
> >                    }
> >            });
> >    }
>
> >    /**
> >     * We've loaded the user table.  Set up so they
> >     * can press another button to display the data.
> >     */
> >    public void setupForDisplay() {
> >            displayBtn = new Button("Click to Display");
> >            panel.setWidget(0, 1, displayBtn);
> >            displayBtn.addClickListener(new ClickListener() {
> >                    public void onClick(Widget sender) {
> >                            showUsers();
> >                    }
> >            });
> >    }
>
> >    /**
> >     * Load the users from the HTML page.
> >     */
> >    public void loadUsers() {
> >            if (parts == null) {
> >                    String str = stringFromDocument("users");
> >                    parts = str.split("===");
> >                    loadBtn.setText("Click me again");
> >            }
> >            else {
> >                    for (String name : parts) {
> >                            name = name.trim();
> >                            if (name.length() > 0) {
> >                                    usernames.add(name);
> >                            }
> >                    }
> >                    showCount();
> >                    setupForDisplay();
> >            }
> >    }
>
> >    /**
> >     * Just show how many users were actually loaded.
> >     */
> >    public void showCount() {
> >            label = new Label("Total user count: " + usernames.size());
> >            panel.setWidget(1, 0, label);
> >    }
>
> >    /**
> >     * Show the loaded users.
> >     */
> >    public void showUsers() {
> >            try {
> >                    listBox = new ListBox();
> >                    listBox.setVisibleItemCount(20);
> >                    panel.setWidget(2, 0, listBox);
> >                    for (String str : usernames) {
> >                            listBox.addItem(str);
> >                    }
> >            }
> >            catch (Exception e) {
> >                    panel.setText(3, 0, "Error: " + e.getMessage());
> >            }
> >    }
>
> >     /**
> >      * Return a string from the document.
> >      */
> >     public String stringFromDocument(String elementName) {
> >            String retVal = "";
> >            Element params = DOM.getElementById(elementName);
> >         if (params != null) {
> >             retVal = DOM.getInnerText(params);
> >         }
> >            return retVal;
> >     }
> > }
>
> > --- Foo.html ---
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > <html>
> >     <head>
> >         <meta http-equiv="content-type" content="text/html;
> > charset=UTF-8">
> >         <title>GWTMinimum</title>
> >         <script type="text/javascript" language="javascript"
> > src="com.missionmode.gwtminimum.GWTMinimum.nocache.js"></script>
> >     </head>
> >     <body>
> >         <div id="web2"></div>
> > <p id="users" style="display: none;">
> > User 0===
> > User 1===
> > User 2===
> > Repeat more users as desired===
> > </p>
> >     </body>
> > </html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to