Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4817

setHidden method does not working when run together with setFieldOptions in Behavior

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Done
    • Affects Version/s: 6.5.0
    • Fix Version/s: 6.18.0
    • Component/s: Behaviours
    • Labels:
    • Sprint:
      SR4J Sprint 90
    • Critical Points:
      2.9

      Description

      Description

      Users want to create a behaviour to dynamically set some options to a radio button (using setFieldOptions) and set the radio button to visible or hidden (using setHidden). setHidden method does not working when running both methods together in the same code block.

      Steps to Reproduce

      Create a behavior with 2 fields, 1 radio button, and 1 single list field. Use the example code from the library here

      Using the switch statement, run the setHidden method together with setFieldOptions method in the same code block.

      For this testing, I run setHidden(true) and setFieldOptions(options) in 'default case'.

      switch (singleSelectValue) {
      // Notice: The optionSet that is used is changed in each case
      // Change 'Single Select Option...' to match your single select's values.
          case 'Single Select Option 1':
              formSelect.setHidden(false)
              formSelect.setFieldOptions(options.findAll { it.value in optionSet1 }.collectEntries {
                  [(it.optionId): it.value]
              })
              break
          case 'Single Select Option 2':
              formSelect.setHidden(false)
              formSelect.setFieldOptions(options.findAll { it.value in optionSet2 }.collectEntries {
                  [(it.optionId): it.value]
              })
              break
          case 'Single Select Option 3':
              formSelect.setHidden(false)
              formSelect.setFieldOptions(options.findAll { it.value in optionSet3 }.collectEntries {
                  [(it.optionId): it.value]
              })
              break
      // Reset to default options if single select option is null or any other option that is not taken care of
          default:
              formSelect.setHidden(true)
              formSelect.setFieldOptions(options)
      }
      

      Expected Output

      • When the value does not match with any case in the switch statement, the field will be hidden

      Actual Output

      • When the value does not match with any case in the switch statement, the field is still visible

      Additional Notes:

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              msiewruk Mariusz Siewruk [X] (Inactive)
              Reporter:
              rdom Raziman Dom
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: