1. #1
    Ext User
    Join Date
    Aug 2010
    Location
    The Netherlands
    Posts
    7
    Vote Rating
    0
    Dennis86 is on a distinguished road

      0  

    Thumbs up PagingToolBar in Grid disabled after loading

    PagingToolBar in Grid disabled after loading


    Hello

    I have an issue with a PagingToolBar, positioned under my Grid. As soon as the initial load through the loader is completed, the PagingToolBar is being set to disabled and it's buttons cannot be pressed anymore. What is the cause of this problem and how can I solve it?

    Grid build-up:
    Code:
     
    checkBoxSelectionModelGrid.setSelectionMode(SelectionMode.MULTI);
     
    
    
    // Proxy
    rpcProxyGrid = new RpcProxy<PagingLoadResult<GridBean>>(){ @Override public void load(Object loadConfig, AsyncCallback<PagingLoadResult<GridBean>> callback){ service.getGridData((PagingLoadConfig) loadConfig, callback); } };
    // loader
    final BasePagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(rpcProxyGrid, new BeanModelReader()); loader.setRemoteSort(true);
    // store
    listStoreGrid = new ListStore<BeanModel>(loader);
    // toolbar
    pagingToolBarGrid.bind(loader); pagingToolBarGrid.setAlignment(HorizontalAlignment.LEFT); pagingToolBarGrid.setSpacing(10); simpleComboBoxPagingToolbarRules.setFieldLabel("Regels"); pagingToolBarGrid.add(simpleComboBoxPagingToolbarRules); pagingToolBarGrid.add(buttonPagingToolbarPrint); pagingToolBarGrid.add(buttonPagingToolbarExcel); pagingToolBarGrid.add(buttonPagingToolbarCacheVernieuwen); pagingToolBarGrid.add(labelAantalGeselecteerd);
    // columns
    listColumnConfig = new ArrayList<ColumnConfig>();
    listColumnConfig.add(checkBoxSelectionModelGrid.getColumn());
    listColumnConfig.add(new ColumnConfig("requester", "Inkoper", 70)); listColumnConfig.add(new ColumnConfig("servicetype", "Beroepsgroep", 100)); listColumnConfig.add(new ColumnConfig("year", "Contractjaar", 90)); listColumnConfig.add(new ColumnConfig("tabplacement", "Tabplacement", 100)); listColumnConfig.add(new ColumnConfig("ordernr", "Plaats in vragenlijst", 120)); listColumnConfig.add(new ColumnConfig("question", "Vraag", 100)); listColumnConfig.add(new ColumnConfig("qtdescription", "Vraagtype", 80)); listColumnConfig.add(new ColumnConfig("answerswidth", "Antwoorden per regel", 130)); listColumnConfig.add(new ColumnConfig("content", "Info-i", 50)); listColumnConfig.add(new ColumnConfig("active", "Actief?", 60)); listColumnConfig.add(new ColumnConfig("at_type", "Antwoordtype", 100)); listColumnConfig.add(new ColumnConfig("antdescription", "Antwoordgroep", 200));
    columnModelGrid = new ColumnModel(listColumnConfig);
    // Grid
    gridGrid = new Grid<BeanModel>(listStoreGrid, columnModelGrid); gridGrid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>(){ public void handleEvent(GridEvent<BeanModel> be){ loader.load(0, 20); } });
    gridGrid.setSelectionModel(checkBoxSelectionModelGrid);
    gridGrid.addPlugin(checkBoxSelectionModelGrid); gridGrid.setAutoExpandColumn("question"); gridGrid.setColumnLines(true); gridGrid.setLoadMask(true);
    // Panel
    contentPanelGrid.setFrame(true); contentPanelGrid.setCollapsible(true); contentPanelGrid.setAnimCollapse(false); contentPanelGrid.setButtonAlign(HorizontalAlignment.CENTER); contentPanelGrid.setHeading("Resultaten"); contentPanelGrid.setLayout(fitLayoutContentPanelGrid); contentPanelGrid.add(gridGrid); contentPanelGrid.setAutoWidth(true); contentPanelGrid.setHeight(780); contentPanelGrid.setBottomComponent(pagingToolBarGrid); add(contentPanelGrid);
    RootPanel.get().add(this);
    Load call:

    Code:
    public
    PagingLoadResult<GridBean> getGridData(PagingLoadConfig config){ if(listGridBeans == null) listGridBeans = getGridData(1, 1, 2010);
    if(config.getSortInfo().getSortField() != null){ final String sortField = config.getSortInfo().getSortField(); if(sortField != null) Collections.sort(listGridBeans, config.getSortInfo().getSortDir().comparator(new Comparator(){
    public int compare(Object o1, Object o2){
    GridBean gb1 = (GridBean) o1; GridBean gb2 = (GridBean) o2; if(sortField.equals("active")) return gb1.getActive().compareTo(gb2.getActive()); else if(sortField.equals("answerswidth")) return gb1.getAnswerswidth().compareTo(gb2.getAnswerswidth()); else if(sortField.equals("antdescription")) return gb1.getAntdescription().compareTo(gb2.getAntdescription()); else if(sortField.equals("at_type")) return gb1.getAt_type().compareTo(gb2.getAt_type()); else if(sortField.equals("content")) return gb1.getContent().compareTo(gb2.getContent()); else if(sortField.equals("ordernr")) return gb1.getOrdernr().compareTo(gb2.getOrdernr()); else if(sortField.equals("qtdescription")) return gb1.getQtdescription().compareTo(gb2.getQtdescription()); else if(sortField.equals("question")) return gb1.getQuestion().compareTo(gb2.getQuestion()); else if(sortField.equals("tabplacement")) return gb1.getTabplacement().compareTo(gb2.getTabplacement()); return 0; } })); }
    ArrayList<GridBean> sublist = new ArrayList<GridBean>();
    int start = config.getOffset(); int limit = listGridBeans.size(); if(config.getLimit() > 0) limit = Math.min(start + config.getLimit(), limit); for(int i = config.getOffset(); i < limit; i++) sublist.add(listGridBeans.get(i)); return new BasePagingLoadResult<GridBean>(sublist, config.getOffset(), listGridBeans.size());
    }
    To update the grid data, i just update the store belonging to the grid:

    Code:
    service
    .getGridData(requester_id, servicetype_id, year, new AsyncCallback<List<GridBean>>(){ public void onFailure(Throwable caught){
    caught.printStackTrace(); }
    public void onSuccess(List<GridBean> listGridBeans){
    for(GridBean gB: listGridBeans){ BeanModelFactory factory = BeanModelLookup.get().getFactory(GridBean.class); BeanModel model = factory.createModel(gB); view.getStoreGrid().add(model); view.getStoreGrid().commitChanges(); } }
    });
    If any more information is needed, just shoot
    Last edited by Dennis86; 5 Nov 2010 at 3:25 AM. Reason: Code Formatting

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Is it possible you are loading yoru grid twice?

  3. #3
    Ext User
    Join Date
    Aug 2010
    Location
    The Netherlands
    Posts
    7
    Vote Rating
    0
    Dennis86 is on a distinguished road

      0  

    Default


    Throughout my application I am calling loader.load only once.

    But I have commented out this line and now the PagingToolBar is enabled en stays enabled after pressing the refresh button on my PagingToolBar..

    Code:
     
    gridGrid = new Grid<BeanModel>(listStoreGrid, columnModelGrid); gridGrid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>(){ public void handleEvent(GridEvent<BeanModel> be){ // loader.load(0, 20); } });
    You were probably right about the grid being loaded twice Thanks for your help!

  4. #4
    Ext User
    Join Date
    Aug 2010
    Location
    The Netherlands
    Posts
    7
    Vote Rating
    0
    Dennis86 is on a distinguished road

      0  

    Default


    I think I am not using the RPCProxy correctly. I load my data through updating the store and commiting the changes. I think I have to do all the data loading through the RPCProxy, is that right?

Similar Threads

  1. PagingToolbar disabled even though there more than one page
    By sempervivo in forum Ext GWT: Discussion
    Replies: 4
    Last Post: 3 Nov 2010, 7:57 AM
  2. How to block a Window? like loading on PagingToolBar
    By edumrf in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 24 Sep 2009, 6:14 AM
  3. PagingToolbar - loading property
    By coldflame in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 2 Jul 2009, 3:59 AM
  4. Grid loading icon on Refresh button in PagingToolbar not showing
    By hanne in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 18 May 2009, 12:21 PM
  5. Replies: 1
    Last Post: 8 Feb 2009, 4:44 PM

Thread Participants: 1

Tags for this Thread