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

Fragment doesn't support forEach with iterative variable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.0
    • None
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.6.0 S1

      Steps to Reproduce

      http://zkfiddle.org/sample/39mq57t/3-fragment-forEach
      using fragment with forEach with begin / end:

      		<forEach begin="0" end="3">
      			<button label="@load(each)"/>
      		</forEach>
      

      Current Result

      Error in JS console:

      Expected Result

      fragment should iterate on the variable as when using shadow forEach in java / zul

      Debug Info

      The JS code breaks because the "items" attribute is undefined.
      The zk$$forEach method tries to access items.length wich causes a NPE at client side.
      https://github.com/zkoss/zkcml/blob/35ee33e1f1f7a5357598d36c3adde3a5b153c82c/zkmax/src/archive/web/js/zkmax/wgt/Fragment.js#L184

      Root Cause

      Workaround

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h