简体   繁体   English

ExtJS:为RowEditor设置自定义验证消息

[英]ExtJS: set custom validation message for the RowEditor

Does anyone know how to make RowEditor in ExtJS 3.4 show a custom validation message? 有谁知道如何使ExtJS 3.4中的RowEditor显示自定义验证消息?

Eg, the ExtJS sample ( http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/row-editor.html ) the first column editor is defined like this: 例如,ExtJS示例( http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/row-editor.html )第一列编辑器的定义如下:

editor: {
    xtype: 'textfield',
    allowBlank: false
}

With this RowEditor displays a "Field is required" message when this field is empty. 当此字段为空时,此RowEditor会显示“Field is required”消息。 I need to replace this message with a custom one, so I change the editor definition: 我需要用自定义消息替换此消息,因此我更改了编辑器定义:

editor: {
    xtype: 'textfield',
    allowBlank: false,
    invalidText: 'Cannot be empty'
}

but the RowEditor still displays the default message. 但RowEditor仍然显示默认消息。 Any suggestions? 有什么建议么?

Thank you. 谢谢。

As your validation is if allowBlank,so you should use the property "blankText", 如果您的验证是allowBlank,那么您应该使用属性“blankText”,

editor: {
  xtype: 'textfield',
  allowBlank: false,
  blankText: 'Cannot be empty'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM