Interface ValueMap


public interface ValueMap
A ValueMap defines the set of legal values for a field, and optionally allows you to provide a mapping from stored values to values as seen by the end user.

A valueMap can be specified as either an Array of legal values, or as an Object where each property maps a stored value to a user-displayable value. See DataSourceField.valueMap for how to express a ValueMap in Component XML.

A ValueMap can be entirely static or entirely dynamic, with many options in between. For example, a ValueMap may be:

  • statically defined in a JavaScript or XML file. Such a valueMap changes only when application code is upgraded.
  • generated dynamically by server code when the application first loads, for example, by generating JavaScript or XML dynamically in a .jsp or .asp file. Such a valueMap may be different for each session and for each user.
  • loaded on demand from a DataSource, via the optionDataSource property, or via a call to DataSource.fetchData() where a valueMap is derived dynamically from the returned data (see DataSource.fetchData() for an example). Such a valueMap may be updated at any time, for example, every time the user changes a related field while editing data.
See also the Smart GWT Architecture Overview to understand the best architecture from a performance and caching perspective.