Results 1 to 3 of 3

Thread: How to change the values in the combo-box at runtime

  1. #1
    Join Date
    Jul 2007
    Posts
    4

    Default How to change the values in the combo-box at runtime

    Hi,

    In my form I've a combobox binding as follows:
    Code:
    Binding binding = bf.createBoundComboBox("option", createInitialValueModel());
    formBuilder.add(binding);
    ...
    ...
    private Object createInitialValueModel() {
         return new ValueHolder(new String[] { "OptionA", "OptionB", "OptionC"});
    }
    So my combo-box is shown with following options when it's opened.
    OptionA
    OptionB
    OptionC

    How Can I change the values in this combobox to the following at runtime?
    OptionX
    OptionY
    OptionZ

  2. #2

    Default

    Search the forum for RefreshableValueHolder, there are some examples on how to use it.

  3. #3
    Join Date
    Jul 2007
    Posts
    4

    Default

    thanks t0asti.

    The RefreshableValueHolder works. I could change the options in my combo-box by calling refresh() on the RefreshableValueHolder.

    Code:
    private RefreshableValueHolder createOptionsModel() {
         return new RefreshableValueHolder(new Closure() {
    	public Object call(Object arg0) {
    	return options.toArray();
    	}			
        });
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •