Copy paste functionality of ParamQuery grid is compatible with any spreadsheet application like MS Excel i.e., data can be copied from ParamQuery Grid and pasted to other spreadsheets and vice versa.
Please note:
By default all the rows and columns in a Range or Selection of cells are copied.
Columns can be skipped from copied data by setting column.copy to false.
Similarly rows can be skipped from copied data by setting pq_copy
property to false.
Sometimes it's required to skip rows and columns conditionally in run time e.g. skip hidden rows and columns while copying. To ahieve that,
we convert column.copy
property to javascript getter, which can be defined in the grid initialization object. Furthermore columnTemplate can be used to propagate getter copy property to all columns.
columnTemplate: { get copy(){ return !this.hidden; } }
or by updating existing grid initialization object (before initialization of grid)
Object.defineProperty(obj.columnTemplate, 'copy', { enumerable: true, get (){ return !this.hidden; } })
Similarly it can be set up for rows by using their counterpart properties, rowTemplate, rowData.pq_hidden, rowData.pq_copy.
By default all the target rows and columns are pasted over by copied data.
Target columns can be skipped by setting column.paste to false.
Similarly target rows can be skipped by setting pq_paste
property to false.
Sometimes it's required to skip rows and columns in target grid conditionally in run time e.g., to skip hidden rows and columns in the target Range/Selection while pasting. To ahieve that, column.paste
can be linked to column.hidden
property by using javascript getters
which can be defined in the grid initialization object. We use columnTemplate to propagate paste property to all columns.
columnTemplate: { get paste(){ return !this.hidden; } }
or by updating existing grid initialization object (before initialization of grid)
Object.defineProperty(obj.columnTemplate, 'paste', { enumerable: true, get (){ return !this.hidden; } })
Similarly it can be set up for rows by using their counterpart properties, rowTemplate, rowData.pq_hidden, rowData.pq_paste.