UndoRedo

A widget which encapsulates undo/redo functionality for the project of a scheduling widget (Scheduler, Gantt or Calendar).

To make use of this, the project must be configured with a State Tracking Manager.

Note that this widget will automatically enable the stm instance, upon the load event of the project's crud manager.

If inserted into a scheduling widget (such as into a tbar, or bbar, or as an item in a context menu), the project of the encapsulating scheduling widget will be used.

If this widget is to be used "standalone" (rendered into the DOM outside of a scheduling widget), this must be configured with a reference to the project, or the scheduling widget which is using the project. This can be done with the project and scheduler config options correspondingly.

There are three child widgets encapsulated which may be referenced through the widgetMap:

  • undoBtn - The button which operates the undo operation (CTRL+Z, or CMD+Z in Mac OS)
  • transactionsCombo - A combobox into which is pushed the list of transactions,
  • redoBtn - The button which operates the redo operation (CTRL+SHIFT+Z, + CMD+SHIFT+Z in Mac OS)

To disable keyboard shortcuts for undo/redo, set enableUndoRedoKeys to false.

The transactionsCombo may be configured away if only the buttons are required:

{
    type      : 'undoredo',
    items     : {
        transactionsCombo : null
    }
}

The example below illustrated how to embed an undoredo widget in the top toolbar of a Scheduler.

Undo redo
//<code-header>
fiddle.title = 'Undo redo';
//</code-header>
new Scheduler({
    appendTo : targetElement,
    height   : 400,
    width    : 600,

    // All Schedulers have a Project which encapsulates their data model
    // If we configure it with an STM, it enables undo/redo functionality.
    project : {
        stm : {
            autoRecord : true
        }
    },

    resources : [
        { id : 1, name : 'Bernard' },
        { id : 2, name : 'Bianca' }
    ],

    events : [
        { id : 1, resourceId : 1, name : 'Interview', location : 'Office', startDate : '2018-05-07', endDate : '2018-05-10' },
        { id : 2, resourceId : 2, name : 'Meeting', location : `Client's office`, startDate : '2018-05-10', endDate : '2018-05-12' }
    ],

    // Add an undoredo widget to our top toolbar. It will seek the project of its owner.
    tbar : {
        items : {
            undoRedo : {
                type : 'undoredo'
            }
        }
    },

    startDate : new Date(2018, 4, 6),
    endDate   : new Date(2018, 4, 13),

    columns : [
        { field : 'name', text : 'Name', width : 100 }
    ]
});

Configs

96

Common

listenersEvents

Data

The Scheduling project's whose transaction to track.

    {
        type    : 'undoredo',
        project : scheduler.project
    }

Other

Button color for the undo and redo buttons. See color.

scheduler: Widget | String

The Scheduling Widget (or its id) whose transaction to track.

This may be a Scheduler, a Gantt or a Calendar.

    {
        type      : 'undoredo',
        scheduler : myCalendar
    }

Configure as true to show "0" badge on the undo and redo buttons when they have no actions left to perform. By default when there are no actions, no badge is displayed.

Configure as true to show "Undo" and "Redo" as button texts. The buttons always have a tooltip as a hint to the user as to their purpose.

columnWidget
defaultFocusContainer
labelPositionContainer
renditionContainer
rtlRTL
spanWidget

Accessibility

ariaLabelWidget
keyMapKeyMap

Content

defaultsContainer
itemsContainer
lazyItemsContainer
namedItemsContainer
textContentContainer

CSS

borderContainer
clsWidget
htmlClsWidget
itemClsContainer
styleWidget
uiWidget

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget
titleWidget

Float & align

alignWidget
anchorWidget
centeredWidget
draggableWidget
floatingWidget
xWidget
yWidget

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
hideWhenEmptyContainer
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

misc

tabBarItemsContainer

Misc

dataFieldWidget
disabledWidget
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget
tooltipWidget

Record

recordContainer

Scrolling

Properties

85

Class hierarchy

isUndoRedo: Boolean= truereadonly
Identifies an object as an instance of UndoRedo class, or subclass thereof.
isUndoRedo: Boolean= truereadonlystatic
Identifies an object as an instance of UndoRedo class, or subclass thereof.
isUndoRedoBase: Boolean= truereadonlyUndoRedoBase
Identifies an object as an instance of UndoRedoBase class, or subclass thereof.
isUndoRedoBase: Boolean= truereadonlystaticUndoRedoBase
Identifies an object as an instance of UndoRedoBase class, or subclass thereof.
isContainerContainer
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLocalizableLocalizable
isWidgetWidget

Data

Get/set ProjectModel instance, containing the data visualized by the SchedulerPro.

Accessibility

keyMapKeyMap

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
layoutContainer
layoutStyleContainer
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
tooltipWidget

Other

$namestaticWidget
columnWidget
firstItemContainer
hasChangesContainer
isValidContainer
itemsContainer
labelPositionContainer
lastItemContainer
renditionContainer
rtlRTL
spanWidget
typestaticWidget
valuesContainer

Record

recordContainer

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget
widgetMapContainer

Functions

67

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

addContainer
composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
getAtContainer
getWidgetByIdContainer
insertContainer
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
removeContainer
removeAllContainer
resetValuesContainer
setValuesContainer
triggerEvents
unEvents
unmaskWidget

Visibility

hideWidget
showWidget

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

16
catchAllEvents
destroyEvents
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget

Event handlers

16

Typedefs

6

CSS variables

31

Inherited