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

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

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: 9.0.1.2
    • Fix Version/s: 9.6.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: