Threaded View

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    11
    Vote Rating
    0
    reco123 is on a distinguished road

      0  

    Default Answered: Touch 2 List loading mask problem !!!!

    Answered: Touch 2 List loading mask problem !!!!


    I have a question about set list masked. Here is my code. I use "masked" to gray out the list before data get loaded. But how can I remove the mask afterward?

    I tried to listen to the event load.. but it never fired.. which event i should listen to ?
    also, I tried to use c.setMasked(false); but it does't work. how can i get the list instance inside the event function?
    Thanks!

    Code:
        var list =     {
          xtype: 'list',
          title: 'Game List',
          id: 'gameList',
          ui: 'round',
          flex: 1,
          width: 300,
          store: 'Games',
          cls: 'gameList',
          masked: {
                    xtype: 'loadmask',
                    message: 'loading data'
                }, // masked
          listeners: {
            painted: function(c) {
                  list.setMasked(false);
            }
          },
          itemTpl: Ext.create('Ext.XTemplate',
           '<div class="game">',
           '<img class="gameuserpic" src="{userPic}" />',
           '<img class="gamemoveimg" src="resources/images/{action}.png"/>',
           '<p class="info">{userName}</p>',
           '<p class="move">{move}</p>',
           '</div>'),
          //end itemTPl
          emptyText: 'Create some new Game!!'
        };

  2. List components will handle the removal of the mask automatically. Here's the snippet from the source of Ext.dataview.Dataview related to that:

    Code:
    onLoad: function(store) {
        //remove any masks on the store
        this.hasLoadedStore = true;
        this.setMasked(false);
    
    
        if (!store.getCount()) {
            this.showEmptyText();
        }
    }
    Your call to setMasked in the painted event failed because the parameter for that event is not a component but the element. Since the list automatically handles the removal of that mask, you don't need that painted event in there anymore.

    Brice

Thread Participants: 1