Hi
The problem is resovled :-)
Instead reset the number of rows in TableModel, I should really do it in
PageChangeHandler like the following:
public class MyPage implements PageChangeHandler {
private PagingScrollTable<User> table;
...
public void onPageChange(PageChangeEvent event) {
final TableModel model = table.getTableModel();
// RPC call to return total of users
userService.getUserCount(new AsyncCallback<Integer>() {
...
public void onSuccess(Integer total) {
model.setRowCount(total);
}
});
}
}
Thank you!
On Sun, Jun 7, 2009 at 10:49 PM, hezjing <[email protected]> wrote:
> Hi,
>
> I'm creating a PagingScrollTable, and want to set the total of rows after
> RPC call.
> Here is my client code snippet to create the table model:
>
> CachedTableModel<User> cachedTableModel = new CachedTableModel<User>(new
> UserTableModel());
> cachedTableModel.setPreCachedRowCount(10);
> cachedTableModel.setPostCachedRowCount(10);
>
>
> Then, I'm trying to calculate the number of rows while creating the table
> model and every requestRows() is called:
>
> class UserTableModel extends MutableTableModel<User> {
>
> UserTableModel() {
> // RPC call to return total of users
> userService.getUserCount(new AsyncCallback<Integer>() {
> ...
> public void onSuccess(Integer total) {
> setRowCount(total);
> }
> });
> }
>
> public void requestRows(final Request request, final
> TableModel.Callback<User> callback) {
> ...
> // RPC call to return total of users
> userService.getUserCount(new AsyncCallback<Integer>() {
> ...
> public void onSuccess(Integer total) {
> setRowCount(total);
> }
> });
> }
> }
>
>
> The problem is the PagingScrollTable does not showing the total of rows,
> the last button is not display too!
>
> May I know where is the appropriate place to reset the number of rows?
>
>
> Please help, thank you!
>
>
> --
>
> Hez
>
--
Hez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---