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

listbox selectAll checkbox stops synchronizing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.2
    • 8.5.1
    • Components
    • Security Level: Jimmy

      Steps to Reproduce

      <zk>
      	<listbox id="lb" multiple="true" checkmark="true">
      		<listhead>
      			<listheader label="name"/>
      		</listhead>
      		<listitem label="One" />
      		<listitem label="Two" />
      	</listbox>
      	<button label="clear selection" onClick="lb.clearSelection()"/>
      </zk>
      

      Current Result

      when toggling items "One" and "Two" individually the selectAll checkbox synchronizes automatically
      also the "clear selection" button removes unchecks all 3 checkboxes as expected

      Problems happen after checking selectAll once (using the checkbox in the listheader)
      -> the automatic synchronization fails ...
      e.g.:

      1. when "One" is selected -> selecting "Two" doesn't update the selectAll checkbox anymore
      2. when all 3 are checked, clicking "clear selection" doesn't update the selectAll checkbox

      Expected Result

      keep selectAll in sync with individual checkboxes

      Workaround

      use a ListModelList with a listitem-template (here an example using zscript, also possible in java)

      <zk>
      	<zscript><![CDATA[
      		ListModelList items = new ListModelList();
      		items.add("One");
      		items.add("Two");
      		items.setMultiple(true);
      	]]></zscript>
      	<listbox id="lb" model="${items}" checkmark="true">
      		<listhead>
      			<listheader label="name"/>
      		</listhead>
      		<template name="model">
      			<listitem label="${each}"/>
      		</template>
      	</listbox>
      	<button label="clear selection" onClick="items.clearSelection()"/>
      </zk>
      

            CharlesQiu CharlesQiu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 5 hours Remaining Estimate - 3 hours
                3h
                Logged:
                Time Spent - 5 hours Remaining Estimate - 3 hours
                5h