breezejs:覆盖显示名称 [英] breezejs: overriding displayname
问题描述
我正在自定义验证邮件。使用messageTemplates属性可以正常工作。但是,它使用%displayName%呈现属性的名称,但我找不到如何覆盖此值?反正有这样做吗?
I'm in the process of customizing validation messages. It's working fine using the messageTemplates property. However it uses %displayName% to render the name of the property and I can't find out how to override this value ? Is there anyway to do that ?
推荐答案
这还没有详细记录,但是您可以在任何dataProperty上简单地设置'displayName'属性,它将覆盖自动生成的属性显示名称,将用于此属性的所有验证消息。因此
This is not YET well documented but you can simply set the 'displayName' property on any dataProperty and this will override the autogenerated display name and will be used for all validation messages for this property. So
var custType = myEntityManager.metadataStore.getEntityType("Customer");
var dp = custType.getProperty("companyName");
dp.displayName = "My custom display name";
另外,请参阅此页底部的自定义消息模板:微风验证
Also, please see "Customize the message templates" at the bottom of this page: Breeze Validation
这篇关于breezejs:覆盖显示名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!