AllocationCopyPaste

This is a feature of ResourceUtilization view that allows to copy-paste assignment time-phased effort values.

Allocation copy paste
// <code-header>
fiddle.title = 'Allocation copy paste';
// 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.

Configs

18

Common

disabledInstancePlugin
listenersEvents

Other

Provide true to accept pasting in an event timespan only.

copyOnlyCopyPasteBase
dateFormatCopyPasteBase
emptyValueCharCopyPasteBase
generateNewNameCopyPasteBase
keyMapCopyPasteBase
toCopyStringCopyPasteBase
toPasteValueCopyPasteBase
useNativeClipboardCopyPasteBase

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Properties

18

Common

disabledInstancePlugin

Class hierarchy

isAllocationCopyPaste: Boolean= truereadonly
Identifies an object as an instance of AllocationCopyPaste class, or subclass thereof.
isAllocationCopyPaste: Boolean= truereadonlystatic
Identifies an object as an instance of AllocationCopyPaste class, or subclass thereof.
isClipboardableClipboardable
isCopyPasteBaseCopyPasteBase
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Other

generateNewNameCopyPasteBase

Functions

32

Common

clearClipboardClipboardable

Other

Copies selected cells to clipboard (native if accessible) to paste later

Cuts selected cells to clipboard (native if accessible) to paste later

Pastes string data into a cell or a range of cells. Either from native clipboard if that is accessible or from a fallback clipboard that is only available to the owner view.

The string data will be split on \n and \t and put in different rows and columns accordingly.

Note that there must be a selected cell to paste the data into.

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Events

9

Fires on the owning view before a copy action is performed, return false to prevent the action

// Adding a listener using the "on" method
allocationCopyPaste.on('beforeCopyTimelineCells', ({ source, cells, data, isCut }) => {

});
ParameterTypeDescription
sourceResourceUtilization

Owner view

cellsTimelineContext[]

The cells about to be copied or cut

dataString

The string data about to be copied or cut

isCutBoolean

true if this is a cut action

Fires on the owning Grid before a paste action is performed, return false to prevent the action

// Adding a listener using the "on" method
allocationCopyPaste.on('beforePasteTimelineCells', ({ source, clipboardData, targetCell }) => {

});
ParameterTypeDescription
sourceResourceUtilization

Owner view

clipboardDataString

The clipboardData about to be pasted

targetCellTimelineContext

The cell from which the paste will be started

Fires on the owning view after a copy action is performed.

// Adding a listener using the "on" method
allocationCopyPaste.on('copyTimelineCells', ({ source, cells, copiedDataString, isCut }) => {

});
ParameterTypeDescription
sourceResourceUtilization

Owner view

cellsTimelineContext[]

The cells about to be copied or cut

copiedDataStringString

The concatenated data string that was copied or cut

isCutBoolean

true if this was a cut action

Fires on the owning view after a paste action is performed.

// Adding a listener using the "on" method
allocationCopyPaste.on('pasteTimelineCells', ({ source, clipboardData, modifiedRecords, targetCell }) => {

});
ParameterTypeDescription
sourceResourceUtilization

Owner view

clipboardDataString

The clipboardData that was pasted

modifiedRecordsModel[]

The records which have been modified due to the paste action

targetCellTimelineContext

The cell from which the paste will be started

catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin

Event handlers

9

Called on the owning view before a copy action is performed, return false to prevent the action

new AllocationCopyPaste({
    onBeforeCopyTimelineCells({ source, cells, data, isCut }) {

    }
});
ParameterTypeDescription
sourceResourceUtilization

Owner view

cellsTimelineContext[]

The cells about to be copied or cut

dataString

The string data about to be copied or cut

isCutBoolean

true if this is a cut action

Called on the owning Grid before a paste action is performed, return false to prevent the action

new AllocationCopyPaste({
    onBeforePasteTimelineCells({ source, clipboardData, targetCell }) {

    }
});
ParameterTypeDescription
sourceResourceUtilization

Owner view

clipboardDataString

The clipboardData about to be pasted

targetCellTimelineContext

The cell from which the paste will be started

Called on the owning view after a copy action is performed.

new AllocationCopyPaste({
    onCopyTimelineCells({ source, cells, copiedDataString, isCut }) {

    }
});
ParameterTypeDescription
sourceResourceUtilization

Owner view

cellsTimelineContext[]

The cells about to be copied or cut

copiedDataStringString

The concatenated data string that was copied or cut

isCutBoolean

true if this was a cut action

Called on the owning view after a paste action is performed.

new AllocationCopyPaste({
    onPasteTimelineCells({ source, clipboardData, modifiedRecords, targetCell }) {

    }
});
ParameterTypeDescription
sourceResourceUtilization

Owner view

clipboardDataString

The clipboardData that was pasted

modifiedRecordsModel[]

The records which have been modified due to the paste action

targetCellTimelineContext

The cell from which the paste will be started

onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin

Typedefs

1