revertLastLayoutChange()
Home > @gooddata/sdk-ui-dashboard > revertLastLayoutChange
revertLastLayoutChange() function
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A convenience function to create UndoLayoutChanges command that will revert the very last command and toss it out of history.
Signature:
export declare function revertLastLayoutChange(correlationId?: string): UndoLayoutChanges;
Parameters
Parameter | Type | Description |
---|---|---|
correlationId | string | (Optional) specify correlation id to use for this command. this will be included in all events that will be emitted during the command processing |
Returns:
Remarks
This is useful if you are implementing complex and cancellable interactions. For instance if you are building drag-and-drop interaction which upon drag start removes item from a section using the RemoveSectionItem command and upon drop places item in a new location using AddSectionItems command.
When the user starts drag, you submit the RemoveSectionItem command (keeping the item in stash). Then user does something to cancel the interaction: you need to restore the layout to the original state: that means to revert the last layout change that was done by your interaction.