!!!###!!!title=paste add row and column plugin——VisActor/VTable tutorial documents!!!###!!!

Paste Add Row Plugin

Introduction

PasteAddRowColumnPlugin is a plugin written to extend the function of adding rows and columns when the data to be pasted is greater than the number of remaining rows and columns in a table.

This plugin listens to the PASTED_dATA event of the vTable instance!

Plugin Configuration

Configuration options for the row and column addition plugin:

export interface AddRowColumnOptions {
  /**
   * Callback function for adding a column
   */
  addColumnCallback?: (col: number, vTable: VTable.ListTable) => void;
  /**
   * Callback function for adding a row
   */
  addRowCallback?: (row: number, vTable: VTable.ListTable) => void;
}

Plugin Example

Initialize the plugin object and add it to the plugins of the vTable configuration.

const pasteAddRowColumnPlugin = new PasteAddRowColumnPlugin();
const option = {
  records,
  columns,
  padding: 30,
  keyboardOptions: {
    copySelected: true,
    pasteValueToCell: true
  },
  plugins: [pasteAddRowColumnPlugin]
};

In order to ensure that the plugin works properly, you need to configure keyboardOptions when vTable is initialized, and set copySelected and pasteValueToCell to true.