0

I am trying to bind to value in defined class, to react on it change. But no reaction happens. I extended object from data.Model, and trying to bind via links, but something doing wrong.

class with parameter:

Ext.define('Platform.core.OssStatusAdapter', {
extend : 'Ext.data.Model',
alternateClassName : [ 'OssStatusAdapter' ],
singleton : true,

fields : [ {
    name : 'ossConected',
    type : 'boolean',
    defaultValue : false
} ]

});

Code in some class where value is changed:

        OssStatusAdapter.set('ossConected',event.connected);

code where expect reaction to binding:

Ext.define('Plugin.scheduler.package.config.PackageConfigurationViewModel', {
    extend : 'Ext.app.ViewModel',
...
    links: {
        ossAdapter: {
            type: 'Platform.core.OssStatusAdapter',
            create: true
        }
    },
...
    formulas : {
        canDeploy : {
            bind : {

                isOssUp : '{ossAdapter.ossConected}'
            },
            get : function(data) {
                return data.isOssUp;
            }
        }
}

but in formula value is not changing. What I missed?

Edgar
  • 1,120
  • 4
  • 28
  • 53

1 Answers1

1

Try to define your formula this way:

formulas: {
    canDeploy: function(get) {
        var connected = get('ossAdapter.ossConected');
        // see if this moves when you change the record
        console.log('connected', connected);
        return connected;
    }
}
rixo
  • 23,815
  • 4
  • 63
  • 68