Results 1 to 5 of 5

Thread: How to notify view model proprty change to its listeners?

  1. #1
    Sencha User
    Join Date
    Jun 2014
    Location
    Murmansk, Russia
    Posts
    284
    Answers
    3
    Vote Rating
    109
      0  

    Default Answered: How to notify view model proprty change to its listeners?

    I would like to notify some property change without changing its value. Something like that:
    this.getViewModel().notifyChange('someProp')

    Could you say how I can do this?

  2. Late reply but maybe for others with same challenge..

    I added an extra method to the viewModel, now if my model depends on some store, I can add a listener to the store and if the store updated I can fire the recalculateFormula!


    Code:
    recalculateFormula: function(formulaName){
       this.getStub(formulaName).formula.react()
    }

  3. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,020
    Answers
    726
    Vote Rating
    950
      0  

    Default

    There's no way to do this. I'm assuming it's because you want something bound to it to be triggered. If so, why not just call the function directly?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #3
    Sencha User
    Join Date
    Jun 2014
    Location
    Murmansk, Russia
    Posts
    284
    Answers
    3
    Vote Rating
    109
      0  

    Default

    Generally I need some view model formulas to be recalculated (their values depend not on view model properties only). Now I solved it by introducing fake property to view model and using get('fakeProperty') in formulas that I want to be recalculated under some circumstances. When I need this I simply change fakeProprty value.

  5. #4
    Sencha Premium Member VDP's Avatar
    Join Date
    Feb 2012
    Location
    Niel, Belgium
    Posts
    94
    Answers
    4
    Vote Rating
    13
      2  

    Default

    Late reply but maybe for others with same challenge..

    I added an extra method to the viewModel, now if my model depends on some store, I can add a listener to the store and if the store updated I can fire the recalculateFormula!


    Code:
    recalculateFormula: function(formulaName){
       this.getStub(formulaName).formula.react()
    }

  6. #5
    Sencha Premium User
    Join Date
    Jun 2011
    Location
    Seattle, WA
    Posts
    31
    Vote Rating
    1
      0  

    Cool So handy

    Quote Originally Posted by VDP View Post
    Code:
    recalculateFormula: function(formulaName){
       this.getStub(formulaName).formula.react()
    }
    Oh man! This is so handy for setting up formulas with more than one dependency. Why can't "bindTo" be an array like Model field's "depends" config?

Posting Permissions

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