Results 1 to 2 of 2

Thread: Problem with paging grid and BeanModel

  1. #1
    Sencha User
    Join Date
    Apr 2010

    Question Problem with paging grid and BeanModel

    I'm having a strange problem with a paging grid using BeanModel objects. My problem is that the grid is always empty although the toolbar shows the correct number of items that should be displayed. I have seen this problem in a previous thread but the problem was related with the model objects and those work fine for me as I show below.

    This is my code:

    public class ShowUsersPanel extends ContentPanel {
        public ShowUsersPanel() {
            RpcProxy<PagingLoadResult<UsersDTO>> proxy = new RpcProxy<PagingLoadResult<UsersDTO>>() {  
                public void load(Object loadConfig, AsyncCallback<PagingLoadResult<UsersDTO>> callback) {  
                    Utils.dbService.searchUsers((PagingLoadConfig) loadConfig, callback);
            BeanModelReader reader = new BeanModelReader();
            final PagingLoader <PagingLoadResult<ModelData>> loader = 
                new BasePagingLoader<PagingLoadResult <ModelData>> (proxy, reader);  
            ListStore <BeanModel> store = new ListStore <BeanModel> (loader);  
            final PagingToolBar toolBar = new PagingToolBar(50);  
            List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
            columns.add(new ColumnConfig("username", "Username", 150));
            columns.add(new ColumnConfig("firstName", "Name", 150));
            columns.add(new ColumnConfig("lastName", "Surname", 150));    
            columns.add(new ColumnConfig("userNotes", "Notes", 200));  
            columns.add(new ColumnConfig("role", "Role", 200));
            ColumnModel cm = new ColumnModel(columns);  
            loader.load(0, 50);
            final Grid<BeanModel> grid = new Grid<BeanModel>(store, cm); 
    The remote call is working fine because I tried to manually transform its return list to BeanModel obects and it worked. Here is the test code I used:

    AsyncCallback <PagingLoadResult<UsersDTO>> groupCallback = 
                new AsyncCallback<PagingLoadResult<UsersDTO>>() {
                public void onSuccess(PagingLoadResult<UsersDTO> result) {
                    GWT.log("result " + result.getData().size());
                    GWT.log("result 2 " + result.getData().get(0).getUsername());
                    BeanModelFactory factory = BeanModelLookup.get().getFactory(UsersDTO.class);
                    List<BeanModel> xx =factory.createModel(result.getData());
                    GWT.log("result 3 " + xx.get(0).get("username"));            
                public void onFailure(Throwable caught) {
                    GWT.log("error", caught);
            PagingLoadConfig loadConfig = new BasePagingLoadConfig();
            Utils.dbService.searchUsers(loadConfig, groupCallback);
    Any help woud be very appreciated as I been stuck with this problem for a few days now.

  2. #2
    Sencha User
    Join Date
    Apr 2010

    Default SOLVED

    Just in case anybody else has this same problem I have solved it by changing my code from the class constructor to the onRender method.
    Besides I changed the class from a ContentPanel to a LayoutContainer with a ContentPanel with the grid inside.

    If anyone has a clue I would like to know why this happens that way (I have other widgets implemented in the constructor which work fine) and if it is wrong to implement this kind of code in the class constructor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts