breeze: custom enum values -


enums come server myenum.somevalue i'd show on screen formatted value such "some value" instead of somevalue. part of attribute on server-side model won't passed in metadata. what's best place kind of thing breeze ?

we've discussed idea of "extensible" metadata breeze have not yet implemented it. please vote here.

but in meantime, there nothing stopping "enhancing" metadata returned breeze yourself. best way add own properties either "metadatastore", "entitytype" or "dataproperty" classes.

the advantage of adding custom metadata existing metadata objects data available whenever work of basic breeze metadata.

perhaps this: ( haven't confirmed code correct)

var custtype = myentitymanager.metadatastore.getentitytype("customer");  // assume 'status' property enumerated value want  // add custom metadata. var statusprop = custtype.getproperty("status");   // enumdescriptions custom property statusprop.enumdescriptions = {    "paidup": "paid up",    "delinq": "delinquent",   "inarr":  "in arrears" }; 

now anywhere given "status" dataproperty, ( such in validation), have access "enumdescriptions"

hope makes sense.


Comments