mixitup.State

mixitup.State objects expose various pieces of data detailing the state of a MixItUp instance. They are provided at the start and end of any operation via callbacks and events, with the most recent state stored between operations for retrieval at any time via the API.

id
Type Default
string ''

The ID of the mixer instance.

activeFilter
Type Default
mixitup.CommandFilter null

The currently active filter command as set by a control click or API call.

activeSort
Type Default
mixitup.CommandSort null

The currently active sort command as set by a control click or API call.

activeContainerClassName
Type Default
string ''

The current layout-specific container class name, if applied.

container
Type Default
Element null

A reference to the container element that the mixer is instantiated on.

targets
Type Default
Array.<Element> []

An array of all target elements indexed by the mixer.

hide
Type Default
Array.<Element> []

An array of all target elements not matching the current filter.

show
Type Default
Array.<Element> []

An array of all target elements matching the current filter and any additional limits applied such as pagination.

matching
Type Default
Array.<Element> []

An array of all target elements matching the current filter irrespective of any additional limits applied such as pagination.

totalTargets
Type Default
number -1

An integer representing the total number of target elements indexed by the mixer. Equivalent to state.targets.length.

totalShow
Type Default
number -1

An integer representing the total number of target elements matching the current filter and any additional limits applied such as pagination. Equivalent to state.show.length.

totalHide
Type Default
number -1

An integer representing the total number of target elements not matching the current filter. Equivalent to state.hide.length.

totalMatching
Type Default
number -1

An integer representing the total number of target elements matching the current filter irrespective of any other limits applied such as pagination. Equivalent to state.matching.length.

hasFailed
Type Default
boolean false

A boolean indicating whether the last operation "failed", i.e. no targets could be found matching the filter.

triggerElement
Type Default
Element null

The DOM element that was clicked if the last operation was triggered by the clicking of a control and not an API call.

activeDataset
Type Default
Array.<object> null

The currently active dataset underlying the rendered targets, if the dataset API is in use.