1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default Way to override Model's validations?

    Way to override Model's validations?


    We use overrides to customize our app for each client. I have this and see the dynamic loading is loading it, but it doesn't work. Any ideas?

    Code:
    Ext.define('Csg.client.model.CreditCardPayment', {
    
    
        override: 'Csg.model.CreditCardPayment',
    
    
        config: {
    
    
            validations: [{
                type: 'format',
                field: 'securityCode',
                matcher: /.*/
            }]
        }
    });

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    Don't know if it's the best way but this works:

    Code:
    Ext.define('Csg.client.model.CreditCardPayment', {
    
    
        override: 'Csg.model.CreditCardPayment',
    
    
        validate: function(options) {
            var me = this,
                errors = me.callParent();
    
    
            return (errors.removeAll(errors.getByField('securityCode')));
        }
    });

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    Here is what I came up with. Still don't love it but it appears you can't override validations in config for a model. Would love to hear any feedback.

    Code:
    Ext.define('Csg.client.model.CreditCardPayment', {
    
    
        override: 'Csg.model.CreditCardPayment',
    
    
        overrideValidations: {
            remove: [
                'securityCode-format'
            ],
            update: {
                'authorizedPaymentAmount-format': {
                    matcher: /^\d+\.?\d{2}$/,
                    message: Csg.text('mobile.validation.format.message')
                }
            }
        },
    
    
        constructor: function() {
            var me = this,
                validations;
    
    
            me.callParent(arguments);
            validations = me.validations;
    
    
            Ext.each(me.overrideValidations.remove, function(item) {
                validations.removeAtKey(item);
            }, me);
    
    
            Ext.iterate(me.overrideValidations.update, function(key, value) {
                Ext.apply(validations.getByKey(key), value);
            }, me);
        }
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar