Gantt custom fields - required

Ask for help related to our 2.x versions.
Post Reply
User avatar
Terence
Core Developer
Core Developer
Posts: 1530
Joined: Tue Apr 01, 2014 2:23 pm

Re: Gantt custom fields - required

Post by Terence »

Not sure what your question is. Do you have some code?

Is this ExtJS code not working?

Code: Select all

Ext.define('User', {
    extend: 'Ext.data.Model',
    fields: [
        { name: 'name',     type: 'string' },
        { name: 'age',      type: 'int' },
        { name: 'phone',    type: 'string' },
        { name: 'gender',   type: 'string' },
        { name: 'username', type: 'string' },
        { name: 'alive',    type: 'boolean', defaultValue: true }
    ],

    validators: {
        age: 'presence',
        name: { type: 'length', min: 2 },
        gender: { type: 'inclusion', list: ['Male', 'Female'] },
        username: [
            { type: 'exclusion', list: ['Admin', 'Operator'] },
            { type: 'format', matcher: /([a-z]+)[0-9]{2,3}/i }
        ]
    }
});
http://docs.sencha.com/extjs/6.5.2/clas ... od-isValid

What do you mean by enforce? When the model is configured correctly the isValid method should return false in case validation fails.

Post Reply