ComPDFKit Web SDK
    Preparing search index...

    Function addSortStrategy

    • Registers and activates a sort strategy (a strategy with the same name replaces a built-in one). Requires name and getSortedNotes; otherwise ignored with a warning. When the strategy is not the default position, the notes list is sorted by it, with separators decided by shouldRenderSeparator / getSeparatorContent.

      Parameters

      • strategy: SortStrategy

        { name, getSortedNotes, shouldRenderSeparator?, getSeparatorContent? }.

      Returns void

      // Sort notes by their text length, longest first
      instance.UI.addSortStrategy({
      name: 'length',
      getSortedNotes: notes => notes.sort((a, b) => b.getContents().length - a.getContents().length),
      });