Wagtail client-side components
    Preparing search index...

    Enables the ability for drag & drop or manual re-ordering of elements within a prescribed container or the controlled element.

    Once re-ordering is completed an async request will be made to the provided URL to submit the update per item.

    <fieldset data-controller="w-orderable" data-w-orderable-url-value="/path/to/orderable/">
    <input type="button" data-w-orderable-target="item" data-w-orderable-item-id="1" value="Item 1"/>
    <input type="button" data-w-orderable-target="item" data-w-orderable-item-id="2" value="Item 2"/>
    <input type="button" data-w-orderable-target="item" data-w-orderable-item-id="3" value="Item 3"/>
    </fieldset>

    Hierarchy

    Index

    Constructors

    Properties

    activeClasses: string[]
    animationValue: number

    Transition animation duration for re-ordering.

    chosenClass: string
    containerValue: string

    A selector to determine the container that will be the parent of the orderable elements.

    context: Context
    dragClass: string
    ghostClass: string
    handleTarget: HTMLElement
    hasChosenClass: boolean
    hasDragClass: boolean
    hasGhostClass: boolean
    itemTarget: HTMLElement
    messageValue: string

    A translated message template for when the update is successful, replaces __LABEL__ with item's title.

    order: string[]
    sortable: any
    urlValue: string

    Base URL template to use for submitting an updated order for a specific item.

    blessings: (<T>(constructor: Constructor<T>) => any)[]
    classes: string[] = ...
    outlets: string[]
    targets: string[] = ...
    values: {
        animation: { default: number; type: NumberConstructor };
        container: { default: string; type: StringConstructor };
        message: { default: string; type: StringConstructor };
        url: StringConstructor;
    } = ...

    Accessors

    • get application(): Application

      Returns Application

    • get classes(): ClassMap

      Returns ClassMap

    • get data(): DataMap

      Returns DataMap

    • get element(): ElementType

      Returns ElementType

    • get identifier(): string

      Returns string

    • get options(): {
          animation: number;
          chosenClass?: string;
          dataIdAttr: string;
          dragClass?: string;
          draggable: string;
          ghostClass?: string;
          handle: string;
          onEnd: (
              __namedParameters: {
                  item: HTMLElement;
                  newIndex: number;
                  oldIndex: number;
              },
          ) => void;
          onStart: () => void;
      }

      Returns {
          animation: number;
          chosenClass?: string;
          dataIdAttr: string;
          dragClass?: string;
          draggable: string;
          ghostClass?: string;
          handle: string;
          onEnd: (
              __namedParameters: {
                  item: HTMLElement;
                  newIndex: number;
                  oldIndex: number;
              },
          ) => void;
          onStart: () => void;
      }

    • get outlets(): OutletSet

      Returns OutletSet

    • get scope(): Scope

      Returns Scope

    • get targets(): TargetSet

      Returns TargetSet

    • get shouldLoad(): boolean

      Returns boolean

    Methods

    • Parameters

      • eventName: string
      • Optional__namedParameters: Partial<
            {
                bubbles: boolean;
                cancelable: boolean;
                detail: Object;
                prefix: string;
                target: Element
                | Window
                | Document;
            },
        >

      Returns CustomEvent<Object>

    • Returns void

    • Calculate a manual move either up or down and prepare the Sortable data for re-ordering.

      Parameters

      • __namedParameters: Event
      • direction: Direction

      Returns void

    • Submit an updated ordering to the server.

      Parameters

      • __namedParameters: { id: string; label: string; newIndex: number }

      Returns void

    • Parameters

      • _identifier: string
      • _application: Application

      Returns void