2013-10-21 54 views
0

我有一個Ext.grid.Panel和Ext.grid.plugin.RowEditing插件。Ext.Grid編輯最大長度驗證

它工作正常,但我需要限制2個字符串字段的大小以避免來自數據庫的插入/更新異常。

我已經嘗試過網格列中的maxLength屬性和Ext.data.Model中的validations: [ {type: 'length', field: 'no_fornecedor', max: 49} ]。但是沒有任何工作,ExtJS仍然允許用戶輸入儘可能多的文本,並且沒有任何警告地進行更新。

回答

2

Got it!

在我們必須添加以下editor屬性列:

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