I am trying to implement a scollable celltable and this particular
table can contains thousands of elements.So I want to implement a
behavior in which if i scroll down new elements should be added and
old elements should be deleted(from the beginning) from the celltable.
I am keeping page view size of 50 records and on every scroll, I am
fetching 20 new records appending to celltable via scrollpanel's
scroll handler and also removing elements.

Now the problem is that scrolling is not working when i remove
elements.


code:

scrollable.addScrollHandler(new ScrollHandler() {
                        public void onScroll(ScrollEvent event) {
                                // If scrolling up, ignore the event.
                                HasRows display = (HasRows) table;
                                int oldScrollPos = lastScrollPos;
                                lastScrollPos = scrollable.getScrollPosition();

                                if (oldScrollPos >= lastScrollPos) {
                                        return;
                                }

                                if (display == null) {
                                        return;
                                }
                                int maxScrollTop = 
scrollable.getWidget().getOffsetHeight()
                                                - scrollable.getOffsetHeight();
                                if (lastScrollPos >= maxScrollTop) {
                                        // We are near the end, so increase the 
page size.
                                        int newPageSize = 
Math.min(display.getVisibleRange()
                                                        .getLength() + 
incrementSize, display.getRowCount());

                                        getDataDisp();
                                        for (int i = start; i < dispcnt; i++) {
                                                disp.add(disp20.get(i));
                                                //disp.remove(0);
                                        }
                                        for (int j = 0; j < dispcnt; j++) {
                                                disp.remove(0);
                                        }
                                        dispcnt = 0;
                                        table.setRowCount(disp.size() ,true);
                                        table.setRowData(disp);
                                }


                        }
                });

-- 
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