DataGrid Object not displaying more than 50 items...

208 views
Skip to first unread message

Bill M

unread,
Jan 10, 2012, 2:15:07 AM1/10/12
to Google Web Toolkit
Hi All,

I am trying to load the DataGrid with the results of a query. I have
a DataProvider object connected to the DataGrid table,
and I use a for loop to do a list.add() of a object I created
dynamically that represents a row of data in the table.

However, it seems the table does not store more than 50 items, or at
least it is not displaying more than 50 items.

Has anyone else experience anything like this? Is there a instruction
I am forgetting?

Thanks,
Bill

kretel

unread,
Jan 10, 2012, 5:27:26 AM1/10/12
to google-we...@googlegroups.com
Do you use the pager with your DataGrid? 
Also check if you can see elements being added to the DOM (firebug-it). 

I would have a look at showcase how it works on the example: 


Kris


Bill M

unread,
Jan 10, 2012, 6:44:57 AM1/10/12
to Google Web Toolkit
Hi Kris,

I looked at the example. But, the example is loading static data and
it's using pagination. However, I am loading the data as a result of
a DB query in a for loop (all at once), and I'm using a scrollbar to
view the data (not pagination).

Any other ideas?

Thanks,
Bill

Bill M

unread,
Jan 10, 2012, 7:16:31 AM1/10/12
to Google Web Toolkit
Hi Kris,

I was looking more at the sample program you suggested
(ContactDatabase.java), and I saw this method:


/**
* Add a display to the database. The current range of interest of
the display
* will be populated with data.
*
* @param display a {@Link HasData}.
*/
public void addDataDisplay(HasData<ContactInfo> display) {
dataProvider.addDataDisplay(display);
}

Now, when I load up my query results, I have way more data than can
fit in the current view (i.e. the number of visible rows of data).
Do I have to somehow adjust my viewable row count for the DataGrid
before loading my query results so I could eventually see them?

Thanks,
Bill


On Jan 10, 5:27 am, kretel <krzysztof.re...@gmail.com> wrote:

Thomas Broyer

unread,
Jan 10, 2012, 7:26:16 AM1/10/12
to google-we...@googlegroups.com
DataGrid defaults to a pageSize = 50 (see http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/cellview/client/DataGrid.html#DataGrid() )

You have to call setPageSize the either a very big value, or at least the size of your data if you don't want paging.

That said, if you don't need/want paging, you'd probably better call setRowData/setPageSize on the DataGrid than using an intermediate ListDataProvider.

Dan Verkman

unread,
Jan 10, 2012, 7:53:29 AM1/10/12
to google-we...@googlegroups.com
Tom,

I would imagine I could then perform my query, load the data via the ListDataProvider, and then call setPageSize (or is it setRowCount) with the amount of rows I just loaded?
Would that work, assuming I do not want paging ?

Thanks,
Bill




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/wFAQc_-V_HsJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
Jan 10, 2012, 8:05:23 AM1/10/12
to google-we...@googlegroups.com
I believe you'd have to call setPageSize *before* changing your ListDataProvider; but yes, there's no reason it wouldn't work: ListDataProviders simply calls setRowCount/setRowData on its attached HasData whenever you change its getList().

Dan Verkman

unread,
Jan 12, 2012, 1:18:21 AM1/12/12
to google-we...@googlegroups.com
Hey Tom,

Want to thank you for this answer!

I have another question.  Was wondering if maybe you might know.

I have a DataGrid with a ButtonColumn in it.  
I need to do the following:
1. When I load data into the table via a DataProvider, I need at that time to control whether the button that appears on that row will be active. Is there a way to do this?
2. I need an ability to provide a ClickHandler for these buttons.

Would you might know the answers to these questions?

Would really appreciate it.

Thanks.


-----Original Message-----
From: Thomas Broyer <t.br...@gmail.com>
To: google-web-toolkit <google-we...@googlegroups.com>
Sent: Tue, Jan 10, 2012 3:05 am
Subject: Re: DataGrid Object not displaying more than 50 items...

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
Reply all
Reply to author
Forward
0 new messages