My model has two data fields: persistent and calculated:
Ext.define('My.model.Value', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ { name: 'id', type: 'auto' }, { name: 'percentage', type: 'float' }, // values in 0..1 range { name: 'percentageDecimal', type: 'float', persist: false, calculate: function(v) { v = v.percentage; return Ext.isNumber(v) ? v * 100.0 : v; } } ] });
The percentageDecimal
field is used in a grid and it is editable.
Question: how can I change my model to automatically update percentage
field everytime the percentageDecimal
is updated?
I use ExtJs 5.0.1.