🔬
Selectable
  • Selectable
  • Getting Started
    • Install
    • Set Up
    • States
    • Items
    • Demos
      • Checkboxes
      • Dropzone Integration
      • Sortable Integration
  • API
    • Options
      • appendTo (deprecated)
      • autoRefresh
      • autoScroll
      • classes
      • container
      • filter
      • handle
      • ignore
      • lasso
      • lassoSelect
      • maxSelectable
      • saveState
      • throttle
      • toggle
      • tolerance
      • touch
    • Properties
    • Methods
      • add()
      • attachEvents()
      • clear()
      • deselect()
      • destroy()
      • detachEvents()
      • disable()
      • enable()
      • getItems()
      • getNodes()
      • getSelectedItems()
      • getUnSelectedItems()
      • getSelectedNodes()
      • getUnSelectedNodes()
      • getFirstSelectedItem()
      • getFirstSelectedNode()
      • init()
      • invert()
      • off()
      • on()
      • once()
      • redo()
      • refresh()
      • remove()
      • select()
      • selectAll()
      • setContainer()
      • state()
      • toggle()
      • undo()
      • update()
    • Events
      • init
      • destroyed
      • start
      • drag
      • end
      • select
      • deselect
      • selecting
      • deselecting
      • add
      • remove
      • update
      • state
      • enabled
      • disabled
Powered by GitBook
On this page
  1. API
  2. Events

state

Fires when a state change occurs.


There are three events available:

  • state.save - fires when the current selection is saved.

  • state.undo - fires when the state is undone.

  • state.redo - fires when the state is redone.

The callbacks for all three events contain the current state and all states as the first and second parameters respectively.


Examples

selectable.on("state.save", function(currentState, allStates) {
    // Do something on save
});
selectable.on("state.undo", function(currentState, allStates) {
    // Do something on undo
});
selectable.on("state.redo", function(currentState, allStates) {
    // Do something on redo
});
PreviousupdateNextenabled

Last updated 1 year ago