No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Can I define valueMap with extra meta data?

    When I create a data source instance and set the "type" property to "enum", I can either use the "optionDataSource" or "valueMap" property. If I use the first, I pass it a string with a global ID of a client-only data source instance I create somewhere else in the code. Is this correct? Instead of this, I try to avoid the need to define that client-only data source and use the "valueMap" property, but I guess it only allows me to define it as object, where the keys are the values stored in a database and the values are the texts that get displayed in the browser. When using the "optionDataSource", I have the option to give each record in it extra data that I use somewhere else in my application (eg. whether the record is active).

    So my goal is to eliminate the usage of global data source instances and use "enum" fields in persisted data sources with a value map passed to that data source field also and also have the option to store additional "meta data" for each item in that value map.

    optionDataSource is indeed the way to have a valueMap with additional data, and it’s a compact and simple approach.

    We’re not sure what drawback you perceive. You’ve mentioned something about eliminating the use global DataSources, but optionDataSources aren’t required to be global, and even if they were, there would be no drawback to that that we’re aware of.


      Thanks for the explanation! I will use the "optionDataSource" property with a string corresponding to a globally created ID.