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

out of index of ListModelList.removeRange (0, size) when selected all item

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 7.0.2, 6.5.7, 7.0.3
    • Fix Version/s: 7.0.4
    • Component/s: Components
    • Labels:

      Description

      reproduce step.
      1. make a Listbox
      2. make a ListModelList and set is model of Listbox
      3. set ListModelList.setMultiple = true
      4. ListModelList have >= 3 item
      5. select all item in listBox by press shift and select top, bottom item
      6. call ListModelList.removeRange (0, size) to remove all item in mode.
      => exception outOfBoundIndex is raise.

      reason:
      consider: method ListBox.doSelectionChanged () method is call when each item is remove.
      consider below code block. example model has 3 item
      for (final Listitem item: _items) {
      1. if (item.isLoaded())

      { //selected is meaningful only if loaded 2. boolean sel = selObjs.contains(_model.getElementAt(item.getIndex())); 3. if (sel) ++selCnt; 4. item.setSelected(sel); 5. }

      6. if (selCnt == expSelCnt && selCnt >= _selItems.size())
      7. break; //done (all selected items are sync)
      }

      when item 1 is remove, this block of code is execute. _items.size = _model.size everything is ok.
      when item 2 is remove, this block of code is execute. _items.size = _model.size + 1
      and index of selected item in listBox and model is not sync. but logic of code see it's sync.
      => this for run 3 time (= length of listBox) and out of index of model.

        Attachments

          Activity

            People

            Assignee:
            DevChu DevChu
            Reporter:
            hiepgau hiepgau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: