Results 1 to 3 of 3

Thread: viewModel.linkTo() any way to hook up to events for masking ?

  1. #1
    Touch Premium Member
    Join Date
    Dec 2007
    Location
    Ireland
    Posts
    65

    Default viewModel.linkTo() any way to hook up to events for masking ?

    Hello,

    I'm trying to figure out how to mask/unmask view while doing viewModel.linkTo('theModel', {type: 'Model', id: 1 });

    theModel is updated only when loading is completed. I would like to apply load mask while model is loading. How can I get the
    reference to the model without some hacking around viewModel internals ?


    Thank you for any idea.

  2. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Depending on your version, you can bind to "store.loading" in a viewmodel. I can't remember when it was introduced, IIRC 6.5. The relevant code is in Ext.app.bind.Stub. If you see this in your source, it should be good to go,

    Code:
    loading: 'hasPendingLoad',

  3. #3
    Touch Premium Member
    Join Date
    Dec 2007
    Location
    Ireland
    Posts
    65

    Default

    Hi Evan,

    Thank you for your answer.

    I'm using 7.2.0 modern. I'm aware of "store.loading" binding in a viewModel. The problem I have is with link. I do understand that viewModel is updated only when link is updated. It makes perfect sense. Only if there was a easy way to attach to load event.

    At the moment I have to literately do this.

    In controller.
    Code:
    load: function(id){
         this.getViewModel().set('loading', true);
         App.model.Record.load(id, {
            scope: this,
            callback: function(rec, op, success){
                 this.getViewModel().set('theRecord', rec);
                 this.getViewModel().set('loading', false);
            }
        })
    }
    I was hoping for...


    In a ViewController
    Code:
    load: function(id){
         this.getViewModel().linkTo('theRecord', { type: 'Record', id: id });
    }
    And in a View.
    Code:
    {
        bind: {
            masked: '{theRecord.loading ? "Loading..." : false }'
        }
    }
    All this just because I'm using routing and can not pass objects between views anymore. Just id's.

Posting Permissions

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