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.
//<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
Configs
96Common
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.
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.
DOM
Float & align
Layout
misc
Misc
Scrolling
Properties
85
Properties
85Class hierarchy
Data
Get/set ProjectModel instance, containing the data visualized by the SchedulerPro.