Monday 27 August 2012

Hide Enum values in Form Control


Hide Enum values in Form Control :
Well there are various situations where you  want to show only subset of Enum values :
How to do it :
Well add below , In Class declaration of form
public class FormRun extends ObjectRun
{
    SysFormEnumComboBox         sysFormEnumComboBox;
    Set                         enumSet;// = new Set(Types::Enum);
}

Add below piece of code in Form’s init method :
public void init()
{
    enumSet= new Set(Types::Enum);
    enumSet.add(Enum::A);
    enumSet.add(Enum::B);
    enumSet.add(Enum::C);
    enumSet.add(Enum::D);
   
    sysFormEnumComboBox  = sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(Form,control)),enumNum(enum),enumSet);
    super();
  
}

Well, Please have a deep look on second Argument ,which is control ID.

3 comments:

  1. Thanks Gaurav ! However, do you know how to achieve the same in case of a List Page form since methods in ListPages aren't accessible ?

    ReplyDelete
    Replies
    1. Hi , this can be used with Unbound controls only , that means you can not have this functionality in Grid.

      However , to answer your second question , we can add/override methods only for those control in a list page , which are having property "Target Display" to set as "Client".

      So for adding/overriding any method for any control we need to set the property as mentioned above.

      Thanks,

      Delete
  2. Thanks, Gaurav for the superb sharing, this is exactly what i am looking for.

    ReplyDelete