Thanks a lot, John!

2010/11/16 John LaBanca <jlaba...@google.com>

> Put your list in a ListDataProvider and set the cellTable as the display:
> ListDataProvider<Contact> dataProvider = new ListDataProvider<Contact>(
> CONTACTS);
> dataProvider.addDataDisplay(cellTable);
>
> When you change the visible range of a CellTable, it clears its current
> data and fires a RangeChangeEvent.  Something (like a ListDataProvider) has
> to be listening for the event and provide more data.  In your case, you are
> pushing the initial data, but the CellTable is only retaining the data on
> the current page.  When you change the page, the CellTable is waiting for a
> data provider to push more data into it.
>
> Thanks,
> John LaBanca
> jlaba...@google.com
>
>
>
> On Mon, Nov 15, 2010 at 11:47 AM, stefannMeisner <ste...@meisner-larsen.dk
> > wrote:
>
>> Hi
>>
>> I Am experiencing the same problem. I have tried to setup a simple MVP
>> application. When I get the "bar with the moving bands" I press a link
>> that
>> goes to the same page. The updated page shows the CellTable with the
>> correct
>> lines visible.
>>
>> Any help appreciated. A working example with CellTable and SimplePager
>> would
>> be nice! The documentation seems to be outdated on this subject.
>>
>> Regards,
>> Stefan
>>
>> On 11 Nov., 20:13, Nick Newman <nick.x.new...@gmail.com> wrote:
>> > Hi,
>> >
>> > I'm trying the CellTable from GWT 2.1 and I must be doing something
>> > silly because I cannot get it to page.  When I display the table I see
>> > the first page just fine, but when I press the page-forward button I
>> > get a "busy" indication (a bar with moving bands) and that stays there
>> > forever.
>> >
>> > Could some kind soul take a look at the following sample code (copied
>> > from an example with minor changes) to see what I'm doing wrong.
>> >
>> > Thanks,
>> > Nick
>> >
>> > public class MyModule implements EntryPoint
>> > {
>> >     /**
>> >      * A simple data type that represents a contact.
>> >      */
>> >     static class Contact
>> >     {
>> >         private final String address;
>> >
>> >         private final Date birthday;
>> >
>> >         private final String name;
>> >
>> >         public Contact(String name, Date birthday, String address)
>> >         {
>> >             this.name = name;
>> >             this.birthday = birthday;
>> >             this.address = address;
>> >         }
>> >     }
>> >
>> >     public void onModuleLoad()
>> >     {
>> >         /**
>> >          * The list of data to display.
>> >          */
>> >         List<Contact> CONTACTS = new ArrayList<Contact>();
>> >
>> >         List<Contact> sample = Arrays.asList( //
>> >                 new Contact("John", new Date(80, 4, 12), "123 Fourth
>> > Avenue"), //
>> >                 new Contact("Joe", new Date(85, 2, 22), "22 Lance
>> > Ln"), //
>> >                 new Contact("George", new Date(46, 6, 6), "1600
>> > Pennsylvania Avenue"));
>> >
>> >         // Make lots of entries
>> >         for (int i = 0; i < 50; ++i)
>> >             CONTACTS.addAll(sample);
>> >
>> >         // Create a CellTable.
>> >         CellTable<Contact> table = new CellTable<Contact>();
>> >
>> > table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
>> >
>> >         // Add a text column to show the name.
>> >         TextColumn<Contact> nameColumn = new TextColumn<Contact>()
>> >         {
>> >             @Override
>> >             public String getValue(Contact object)
>> >             {
>> >                 return object.name;
>> >             }
>> >         };
>> >         table.addColumn(nameColumn, "Name");
>> >
>> >         // Set the total row count. This isn't strictly necessary, but
>> > it affects
>> >         // paging calculations, so its good habit to keep the row
>> > count up to date.
>> >         table.setRowCount(CONTACTS.size(), true);
>> >
>> >         // Push the data into the widget.
>> >         table.setRowData(0, CONTACTS);
>> >
>> >         /*
>> >          * Add a pager
>> >          */
>> >        SimplePager.Resources pagerResources =
>> > GWT.create(SimplePager.Resources.class);
>> >        SimplePagerpager = newSimplePager(TextLocation.CENTER,
>> > pagerResources, false, 0, true);
>> >         pager.setDisplay(table);
>> >
>> >         VerticalPanel resultPanel = new VerticalPanel();
>> >         resultPanel.add(pager);
>> >         resultPanel.add(table);
>> >         RootPanel.get("gwt").add(resultPanel);
>> >     }
>> >
>> > }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to google-web-tool...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

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

Reply via email to