AllocationCopyPaste
Feature
This is a feature of ResourceUtilization view that allows copy-pasting assignment time-phased effort values.
// <code-header> // This example uses Scheduler Pro TimePhasedProjectModel class // which is named SchedulerProTimePhasedProjectModel in the Gantt distribution TimePhasedProjectModel = typeof SchedulerProTimePhasedProjectModel !== 'undefined' ? SchedulerProTimePhasedProjectModel : TimePhasedProjectModel; targetElement.innerHTML = '<p>Select an event effort value then use <kbd>CTRL</kbd> + <kbd>C</kbd> to copy it and then use <kbd>CTRL</kbd> + <kbd>V</kbd> to paste it to another selected location:</p>'; // </code-header> const resourceUtilization = new ResourceUtilization({ project : new TimePhasedProjectModel({ loadUrl : 'data/SchedulerPro/examples/view/ResourceUtilization2.json', autoLoad : true, validateResponse : false }), columns : [ { type : 'tree', text : 'Name', field : 'name', width : 150, renderer({ record, value }) { return record.generatedParent ? record.key.name : value; } } ], // the view is not readOnly to allow pasting readOnly : false, features : { // Allow effort values copy/pasting allocationCopyPaste : true, allocationCellEdit : true, scheduleContext : { // allow navigating the time axis cells w/ keyboard keyNavigation : true, // allow multi selecting the time axis cells // (can be useful for copy/pasting values there) multiSelect : true }, treeGroup : { // group by resource levels : [ // group by resource ({ origin }) => { // origin could be an array of time-phased assignments origin = origin[0] || origin; return origin.resource; } ] } }, startDate : new Date(2020, 3, 26), endDate : new Date(2020, 4, 15), appendTo : targetElement, rowHeight : 40, tickSize : 40, minHeight : '21em', // display tooltip showBarTip : true }); new ResourceUtilization({
...
// the view should not be readOnly to allow pasting
readOnly : false,
features : {
// allow effort copy-pasting
allocationCopyPaste : true,
...
},
...
});
This feature is disabled by default.
Useful configs
| Config | Description |
|---|---|
| pasteInEventTimeSpanOnly | Only paste within event timespan |
See also
- AllocationCellEdit — Inline editing of allocation cell values
- ResourceUtilization — The view this feature plugs into
- ResourceHistogram — Companion histogram view for resource data
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Provide
trueto accept pasting in an event timespan only. -
Configure which sources $name this class allows pasting model data from. Accepts string or array. Unspecified accepts all. If source is not accepted, it will try to use the string value instead.
-
Set this to
trueto use native Clipboard API if it is available -
If
truethis prevents cutting and pasting. Will default totrueif CellEdit feature is disabled. Set tofalseto prevent this behaviour. -
The format a copied date value should have when converted to a string. To learn more about available formats, check out DateHelper docs.
-
Default keyMap configuration: Ctrl/Cmd+c to copy, Ctrl/Cmd+x to cut and Ctrl/Cmd+v to paste. These keyboard shortcuts require a selection to be made.