Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3965

Callback issues in radiogroup with model after ZK-3818

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 8.5.2
    • 8.5.1.2
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.5.2 S2

      Steps to Reproduce

      Run fiddle
      http://zkfiddle.org/sample/gg8g6o/3-radiogroup-callback-bugs

      2 actions to test:
      1- during doAfterCompose, "s1" is set as selected
      2 - add s3 to model (click on 2nd button)

      Current Result

      1- radio set as selected in model before rendering is not selected
      press 1st button (select s1) to add to selection after rendering
      2- adding entry to model causes NPE

      Expected Result

      1- radiogroup should follow model selection
      2- radiogroup should be able to add entries to model

      Debug Info

      both caused by the AFTER_CHILD_ADDED event from
      https://github.com/zkoss/zk/commit/5b4e2af427ff9cc5c640f8faf47767c0668f6939#diff-46516529e62220b1c4c4efe660aa50d4R309

      in case 1:
      the after_child_added event triggers org.zkoss.zul.Radiogroup.fixOnAdd(Radio) after setting the selection from model.
      fixOnAdd set the selection to false in this case.

      in case 2:
      the event listener is added to parent radiogroup and is never removed. It will trigger when any child is added to the radiogroup. If the child doesn't have a _group value yet, this will trigger a NPE

      Root Cause

      Workaround

      replace org.zkoss.zul.Radio.onPageAttached(Page, Page) to removed the async. (class attached for 8.5.1.2, note: may cause radiogroups to not recognise nested radio components if not direct child)

            rudyhuang rudyhuang
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h