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

support a way to re-sort a ListModel under MVVM pattern


    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 9.6.0
    • None
    • Security Level: Jimmy
    • None

      Use case

      • a listbox is sorted by sort="auto(language)" by clicking a listheader
      • After adding a new item into ListModel, how to force ListModel to sort again?

      Current Result

      1. call Listheader.sort() , but this is not MVVM way
      2. ListModelList.sort(Comparator<E> cmpr, final boolean ascending) requires 2 parameters but app developers can't get the existing comparator and sorting order

      Proposed solution

      Check attached SortedListModelList
      1. a sort() method that sorts the ListModel with the previous comparator and sorting order
      2. in add(), insert the newly-add item into the proper position instead of sorting the whole list after insertion to keep the whole list sorted in the same way.

        1. 4595.zul
          0.5 kB
        2. SortedListModelList.java
          2 kB
        3. ZK4595VM.java
          0.7 kB

            DevChu DevChu
            hawk hawk
            0 Vote for this issue
            3 Start watching this issue