validationextjsextjs4maxlengthmax-size

Ext.Grid editing with max length validation


I have a Ext.grid.Panel with Ext.grid.plugin.RowEditing plugin.

It's working fine, but I need to limit the size of 2 string fields to avoid insert/update exceptions coming from DB.

I have tried maxLength property in Grid column and validations: [ {type: 'length', field: 'no_fornecedor', max: 49} ] in the Ext.data.Model. But none worked, ExtJS still lets user type as many text as he wants and update with no warning.


Solution

  • Got it!

    In the column we must add the following editor property:

    {
        header: 'name',
        dataIndex: 'id',
        flex: 1,
        editor: {
            allowBlank: false,
            maxLength: 49
        }
    }