Код IT
← Каталог

JavaScript 3-ecosystem-2-frontend-frameworks-4-ext-js-31 — РњРёРєСЃРёРЅС‹

Фрагмент из «JavaScript 3-ecosystem-2-frontend-frameworks-4-ext-js-31»: РњРёРєСЃРёРЅС‹.

javascript javascriptencyclopedia3-ecosystem-2-frontend-frameworks-4-ext-js-31 embed URL статья в энциклопедии
JavaScript main.js
Ext.define('App.mixin.DirtyTracking', {
    extend: 'Ext.Mixin',

    mixinConfig: {
        id: 'dirtytracking'
    },

    // Добавляются методы и обработчики
    onFieldChange: function(field, newValue, oldValue) {
        if (newValue !== oldValue) {
            this.markAsDirty();
        }
    },

    markAsDirty: function() {
        this.dirty = true;
        this.fireEvent('dirtychange', this, true);
    }
});
Ext.define('App.mixin.DirtyTracking', {
    extend: 'Ext.Mixin',

    mixinConfig: {
        id: 'dirtytracking'
    },

    // Добавляются методы и обработчики
    onFieldChange: function(field, newValue, oldValue) {
        if (newValue !== oldValue) {
            this.markAsDirty();
        }
    },

    markAsDirty: function() {
        this.dirty = true;
        this.fireEvent('dirtychange', this, true);
    }
});