Announcement

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

    how to fire setShowIfCondition programmatically

    1. SmartClient Version: 3.1p.2013-04-24/PowerEdition
    2. FF20.0

    Hi,

    we're using the setShowIfCondition on some element to decide dynamically if the element is visible or not:

    formItem.setShowIfCondition(new FormItemIfFunction() {
    @Override
    public boolean execute(FormItem item, Object value, DynamicForm form) {
    return DUMMY_RADIO_GROUP_VALUE.equals(radioButton.getValueAsString());
    }
    });

    It works fine when we're expanding/collapsing a SectionItem (named advancedSection) in which this element is a memeber.

    Now we're changing the value of the readio button programmatically whitout any user interaction and want to fire this method to determine the visibility of the element, for this purpose we tried:

    -form.markForRedraw
    -advancedSection.redraw
    -advancedSection.formItem.redraw
    but none of them made the showIfConditions to do their job.

    Is it a frimework bug and if not could you please give us a hint how to do it right?

    Thanks,
    zapryano
    Last edited by zapryano; 26 Apr 2013, 01:22.

    #2
    A call to redraw() or markForRedraw() should be taking care of this and seems to be working in our testing.

    Can you show us a simple entryPoint class to reproduce this problem? It can probably be as simple as a DynamicForm definition containing the appropriate fields, and something like a button to trigger your application code to dynamically set the value and mark for redraw.

    Regards
    Isomorphic Software

    Comment


      #3
      I am using following code to set visibility conditions, in case it helps someone:

      public void changeVisibility(final FormItem frmItemToHide, final FormItem frmItemOnCondition, final String strConditionToShow) {
      frmItemToHide.setVisible(false);
      frmItemOnCondition.setRedrawOnChange(true);
      frmItemToHide.setShowIfCondition(new FormItemIfFunction() {

      @Override
      public boolean execute(FormItem item, Object value, DynamicForm form) {
      if (frmItemOnCondition.getValue() != null && strConditionToShow != null) {
      if (((String) (frmItemOnCondition.getValue())).equalsIgnoreCase(strConditionToShow)) {
      return true;
      } else {
      return false;
      }
      }else{
      return false;
      }
      }
      });
      }

      This code was working fine for long time, but it stopped working, using markForRedraw() on DynamicForm solved my problem.

      Comment

      Working...
      X