1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    555
    Vote Rating
    24
    estesbubba will become famous soon enough 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
    555
    Vote Rating
    24
    estesbubba will become famous soon enough 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
    555
    Vote Rating
    24
    estesbubba will become famous soon enough 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);
        }
    });

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi