1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default Unanswered: List with setMasked while loading

    Unanswered: List with setMasked while loading


    I have a store that does some fairly heavy processing on itemTap. The process might take up to a few seconds depending on the device it is running on and I need some way of notifying the user that the data is loading.

    I believe that is exactly why there is a list.setMasked method. The problem is when I call setMasked() it only sets the mask after the itemTap method has completed which is no use.

    I have something like this setup:

    Code:
    ....
    
    {
      xtype : 'list',
      store : 'MyStore',
    
      mode : 'MULTI',
      selectedCls : '',
    
      listeners : {
        initialize : function(me) {
          me.onBefore('itemtap', function(list) {
            list.setMasked(true);
          }
          me.onAfter('itemtap', function(list) {
            list.setMasked(true);
          }
        }
      }
    }
    
    ....
    That is obviously psudo-code but you get the idea. I have tried every different way of doing that including: Calling setMasked(true/false) in the itemTap event; Running the setMasked in a setTimeout() method; creating new Ext.LoadMask objects both in the setMasked config and gloabally. None of which worked, which is why I'm here!

    EDIT:

    Oddly enough from a logger's perspective, everything is working fine:


    screenshot2.png

    The 66 messages represent the meat of the itemTap, Showing Loadmask is logged inside a show listener on the loadmask object. Meaning the show event fires for the loadmask despite it not actually displaying until the itemtap has finished.

    Please let me know if I'm missing something here, and thanks in advance for any help!

    bwags
    Last edited by bwags; 29 Jun 2012 at 11:36 AM. Reason: Added logging info

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Answers
    3364
    Vote Rating
    756
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This is probably due to the item it is taking to create the elements and when your JS code for itemtap is firing. Try to delay your itemtap code to let the mask render
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Try to delay your itemtap code to let the mask render
    Thanks for the suggestion.

    Here's what I'm doing:

    Code:
    handleItemTap : function(list, two, three, record) {
    
                var delay = 10;
    
    
                if (Ext.os.is.Android) {
                    // Android is soooo slow.
                    delay = 300;
                }
    
    
                Ext.create('Ext.util.DelayedTask', function() {
                    // the record is currently NOT displayed on the map.
                    record.getLayers(me.getTheMap().getMap());
                    list.setMasked(false);
                }).delay(delay);
    
    
                list.setMasked({
                    xtype : 'loadmask',
                    indicator : true,
                    message : 'Loading...'
                });
    
    }
    This works, but I would like to note the terrible Android performance. Also, that I really don't like this solution. While it works it is not perfect and I think list.setMasked should be ready for a heavy lifting process to take place and make sure it gets done before allowing itself to wait on the code to run next. I'm nowhere near JavaScript expert status but that should be possible right?

    Thanks again mitchell for getting me past that!

    bwags

  4. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,142
    Answers
    131
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    This is interesting. I am able to place a mask on Ext.Viewport any time during my lists' itemtap events and it always shows without any delays or problems. I don't necessarily mask my list, I just mask the whole screen, but definitely interesting.

    In case you want to try that out, you can use this when you listen for the itemtap event on your list:
    Code:
    // ... inside list config ...
    listeners: {
        itemtap: function(me, index, item, record){
            //begin fairly heavy processing
            Ext.Viewport.setMasked({
                xtype: 'loadmask',
                //indicator defaults to true
                message: 'Loading...'
            });
    
            // ... do the processing ...
    
            //and when the processing is complete...
            Ext.Viewport.unmask();
        }
    }

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    Yes, I tried all of that (adding a mask to viewport, adding it to navigation view, creating a new mask, creating a mask on launch and just calling show/hide, pre-defining a mask for the list and hiding it...and about every combination I could come up with), if I try to display a mask w/out the delay it is never displayed. What it will do is call to show it, the show event fires on the mask, the heavy lifting takes place, then hide is called....but the mask never actually shows.

    I tested and it does prevent interacting with the screen but that's only half the battle, I need my users to know that something is happening.

    Thanks for the idea though!

  6. #6
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,142
    Answers
    131
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You can use this to keep updating the mask's text after milestone marks in your fairly heavy code processing to let the user know:
    Code:
    //getMasked() returns a whole bunch of values depending on what's set
    Ext.Viewport.getMasked().setMessage('message here...');
    I'm not sure if that is what you are looking for, though

    Edit: I kinda skimmed over your post. Reading it again I realized this may not help you out, but it was a good idea

  7. #7
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    93
    Vote Rating
    2
    bwags is on a distinguished road

      0  

    Default


    It wasn't, but I hadn't though of that...and your right it is a really cool idea!

  8. #8
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,142
    Answers
    131
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    You'll probably stumble upon the answer over tomorrow's breakfast!

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