Welcome Guest! To enable all features please Login or Register.



How to populate a list of values for selection controls
#1 Posted : Saturday, October 20, 2012 4:35:52 PM(UTC)

Xomega Framework automagically populates the list of possible values for selection controls, such as combo boxes, dropdown lists, list boxes, radio buttons or check boxes, based on the configuration of the underlying Data Property that the control is bound to. The list of values is typically populated from a specific LookupTable that is stored in the lookup cache to avoid repetitive reads of the same static data.

Here are the steps involved in configuring data properties and lists of values in the Xomega Framework.
  1. Set up the code to populate the lookup cache with the lookup table that contains your list. It can be based on a static enumeration defined in the model or a dynamic enumeration defined based on a service operation.
  2. Make sure that the data property for your field extends EnumProperty if the values are strings or EnumIntProperty if the values are integers. If the property was generated as part of the data object from the Xomega model, then you just need to make sure that the logical type for the corresponding parameter extends enumeration or integer enumeration base type.
  3. Set the EnumType attribute of your Data Property to the name of your lookup table/enumeration during your object initialization. If your object was generated from the Xomega model, then it will be taken care of automatically as long as you associate your logical type with your enumeration.
  4. Bind your selection UI control to your data property. If you generate your screen from the Xomega model and it includes your field, then the generated control will be bound to the property automatically. You just need to make sure that your logical type is mapped to the proper selection control.
  5. Your selection list will automatically include a blank item if your property is not required and your selection control does not support deselecting all items. You can also configure what string you would like to see for the blank item instead of an empty string, such as N/A or Empty, by setting the NullString attribute of your Data Property, e.g.
    MyProperty.NullString = "Not Set";

  6. By default, the selection control will display the Text of the Header objects from the lookup table, and will store the ID as the value. You can customize it to use any other unique attribute or a combination of attributes by setting the DisplayFormat and KeyFormat attributes of the data property respectively as follows.
    // store abbreviation additional attribute as the value
    MyEnumProperty.KeyFormat = String.Format(Header.AttrPattern, "abbrev");
    // display values as ID - Text
    MyEnumProperty.DisplayFormat = String.Format("{0} - {1}", Header.FieldId, Header.FieldText));
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.