You found a bug! We've classified it as EXTGWT-2248 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    16
    Vote Rating
    0
    Fedy2 is on a distinguished road

      0  

    Default LiveGrid different behaviors after grid reconfiguring

    LiveGrid different behaviors after grid reconfiguring


    Hi,
    I'm re-configuring a grid which uses a live grid view with a new store and column model.
    If I reconfigure the grid when the scroller is on top nothing happens and a "manual" load is necessary.
    If I reconfigure the grid when the scroller is on the "middle" the loader is automatically called with offset 0 and limit 200.

    I expect to have the same behavior in both cases.

    Here a modification of LiveGridExample that show the case:
    Code:
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    
    
    import com.google.gwt.cell.client.DateCell;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.core.client.Scheduler;
    import com.google.gwt.core.client.Scheduler.ScheduledCommand;
    import com.google.gwt.i18n.client.DateTimeFormat;
    import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    import com.google.gwt.user.client.ui.IsWidget;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.Widget;
    import com.sencha.gxt.core.client.ValueProvider;
    import com.sencha.gxt.core.client.resources.ThemeStyles;
    import com.sencha.gxt.data.client.loader.RpcProxy;
    import com.sencha.gxt.data.shared.ListStore;
    import com.sencha.gxt.data.shared.ModelKeyProvider;
    import com.sencha.gxt.data.shared.PropertyAccess;
    import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
    import com.sencha.gxt.data.shared.loader.PagingLoadResult;
    import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
    import com.sencha.gxt.data.shared.loader.PagingLoader;
    import com.sencha.gxt.widget.core.client.FramedPanel;
    import com.sencha.gxt.widget.core.client.button.TextButton;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
    import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
    import com.sencha.gxt.widget.core.client.event.SelectEvent;
    import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
    import com.sencha.gxt.widget.core.client.grid.ColumnModel;
    import com.sencha.gxt.widget.core.client.grid.Grid;
    import com.sencha.gxt.widget.core.client.grid.LiveGridView;
    import com.sencha.gxt.widget.core.client.grid.LiveToolItem;
    import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
    import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
    
    
    public class LiveGridExample implements IsWidget, EntryPoint {
    
    
        protected Grid<Post> view;
        protected PostProperties props;
        protected PagingLoader<PagingLoadConfig, PagingLoadResult<Post>> gridLoader;
    
    
        @Override
        public Widget asWidget() {
    
    
            RpcProxy<PagingLoadConfig, PagingLoadResult<Post>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Post>>() {
                @Override
                public void load(PagingLoadConfig loadConfig, AsyncCallback<PagingLoadResult<Post>> callback) {
    
    
                    System.out.println("Paging Offset: "+loadConfig.getOffset());
                    System.out.println("Paging Limit: "+loadConfig.getLimit());
                    System.out.println();
    
    
                    int total = 1000;
    
    
                    List<Post> posts = new ArrayList<Post>(100);
    
    
                    for (int i = loadConfig.getOffset(); i<loadConfig.getOffset()+loadConfig.getLimit(); i++) posts.add(new Post("username"+i,"forum"+i,new Date(i), "subject"+i, i));
    
    
                    PagingLoadResultBean<Post> result = new PagingLoadResultBean<Post>(posts, total, loadConfig.getOffset());
    
    
                    callback.onSuccess(result);
                }
            };
    
    
            props = GWT.create(PostProperties.class);
    
    
            gridLoader = new PagingLoader<PagingLoadConfig, PagingLoadResult<Post>>(
                    proxy);
            gridLoader.setRemoteSort(true);
    
    
            ColumnConfig<Post, String> forumColumn = new ColumnConfig<Post, String>(props.forum(), 150, "Forum");
            ColumnConfig<Post, String> usernameColumn = new ColumnConfig<Post, String>(props.username(), 150, "Username");
            ColumnConfig<Post, String> subjectColumn = new ColumnConfig<Post, String>(props.subject(), 150, "Subject");
            ColumnConfig<Post, Date> dateColumn = new ColumnConfig<Post, Date>(props.date(), 150, "Date");
            dateColumn.setCell(new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)));
    
    
            List<ColumnConfig<Post, ?>> columns = new ArrayList<ColumnConfig<Post, ?>>();
            columns.add(forumColumn);
            columns.add(usernameColumn);
            columns.add(subjectColumn);
            columns.add(dateColumn);
    
    
            ListStore<Post> store = new ListStore<Post>(new ModelKeyProvider<Post>() {
                @Override
                public String getKey(Post item) {
                    return "" + item.getId();
                }
            });
    
    
            ColumnModel<Post> cm = new ColumnModel<Post>(columns);
    
    
            final LiveGridView<Post> liveGridView = new LiveGridView<Post>();
            liveGridView.setForceFit(true);
    
    
            view = new Grid<Post>(store, cm) {
                @Override
                protected void onAfterFirstAttach() {
                    super.onAfterFirstAttach();
                    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                        @Override
                        public void execute() {
                            gridLoader.load(0, liveGridView.getCacheSize());
                        }
                    });
                }
            };
    
    
            view.setLoadMask(true);
            view.setLoader(gridLoader);
    
    
            view.setView(liveGridView);
    
    
            FramedPanel cp = new FramedPanel();
            cp.setCollapsible(true);
            cp.setHeadingText("Live Grid Example");
            cp.setPixelSize(600, 390);
            cp.addStyleName("margin-10");
    
    
            VerticalLayoutContainer con = new VerticalLayoutContainer();
            con.setBorders(true);
            con.add(view, new VerticalLayoutData(1, 1));
    
    
            ToolBar toolBar = new ToolBar();
            toolBar.add(new LiveToolItem(view));
            toolBar.addStyleName(ThemeStyles.getStyle().borderTop());
            toolBar.getElement().getStyle().setProperty("borderBottom", "none");
    
    
            con.add(toolBar, new VerticalLayoutData(1, 25));
            con.add(new TextButton("Reconfigure", new SelectHandler() {
    
    
                @Override
                public void onSelect(SelectEvent event) {
                    reConfigureGrid();
                }
            }));
    
    
            cp.setWidget(con);
    
    
            return cp;
        }
    
    
        protected void reConfigureGrid()
        {
            //simply renaming some columns and removing others
            ColumnConfig<Post, String> forumColumn = new ColumnConfig<Post, String>(props.forum(), 150, "MyForum");
            ColumnConfig<Post, String> usernameColumn = new ColumnConfig<Post, String>(props.username(), 150, "MyUsername");
    
    
            List<ColumnConfig<Post, ?>> columns = new ArrayList<ColumnConfig<Post, ?>>();
            columns.add(forumColumn);
            columns.add(usernameColumn);
    
    
            ListStore<Post> store = new ListStore<Post>(new ModelKeyProvider<Post>() {
                @Override
                public String getKey(Post item) {
                    return "" + item.getId();
                }
            });
    
    
            ColumnModel<Post> cm = new ColumnModel<Post>(columns);
    
    
            view.reconfigure(store, cm);
        }
    
    
        @Override
        public void onModuleLoad() {
            RootPanel.get().add(this);
        }
    
    
        class Post {
    
    
            private String username;
            private String forum;
            private Date date;
            private String subject;
            private int id;
    
    
    
    
            /**
             * @param username
             * @param forum
             * @param date
             * @param subject
             * @param id
             */
            public Post(String username, String forum, Date date, String subject, int id) {
                this.username = username;
                this.forum = forum;
                this.date = date;
                this.subject = subject;
                this.id = id;
            }
    
    
            public int getId() {
                return id;
            }
    
    
            public void setId(int id) {
                this.id = id;
            }
    
    
            public String getUsername() {
                return username;
            }
    
    
            public void setUsername(String username) {
                this.username = username;
            }
    
    
            public String getForum() {
                return forum;
            }
    
    
            public void setForum(String forum) {
                this.forum = forum;
            }
    
    
            public Date getDate() {
                return date;
            }
    
    
            public void setDate(Date date) {
                this.date = date;
            }
    
    
            public String getSubject() {
                return subject;
            }
    
    
            public void setSubject(String subject) {
                this.subject = subject;
            }
    
    
        }
    
    
        interface PostProperties extends PropertyAccess<Post> {
            ValueProvider<Post, Date> date();
    
    
            ValueProvider<Post, String> forum();
    
    
            ModelKeyProvider<Post> id();
    
    
            ValueProvider<Post, String> subject();
    
    
            ValueProvider<Post, String> username();
        }
    
    
    }

  2. #2
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    Thanks for the report. At a glance, it seems like something odd is going on here. I'll forward your test case along to the team for further analysis and will post updates here.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Los Angeles
    Posts
    23
    Vote Rating
    0
    austinkottke is on a distinguished road

      0  

    Default


    Anyone have an answer for this?

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar