diff --git a/exports/columngroup.d.ts b/exports/columngroup.d.ts
new file mode 100644
index 000000000..bdb8af1f7
--- /dev/null
+++ b/exports/columngroup.d.ts
@@ -0,0 +1 @@
+export * from './components/columngroup/ColumnGroup';
\ No newline at end of file
diff --git a/exports/columngroup.js b/exports/columngroup.js
new file mode 100644
index 000000000..af1d61abc
--- /dev/null
+++ b/exports/columngroup.js
@@ -0,0 +1,3 @@
+'use strict';
+module.exports = require('./components/columngroup/ColumnGroup.vue');
+
\ No newline at end of file
diff --git a/src/components/column/Column.d.ts b/src/components/column/Column.d.ts
index cf252b7f6..37a2edfba 100644
--- a/src/components/column/Column.d.ts
+++ b/src/components/column/Column.d.ts
@@ -17,4 +17,9 @@ export declare class Column extends Vue {
excludeGlobalFilter?: boolean;
selectionMode?: string;
expander?: boolean;
+ colspan?: number;
+ rowspan?: number;
+ rowReorder?: boolean;
+ rowReorderIcon?: string;
+ reorderableColumn?: boolean;
}
\ No newline at end of file
diff --git a/src/components/column/Column.vue b/src/components/column/Column.vue
index 38de5d24f..d09655ac3 100644
--- a/src/components/column/Column.vue
+++ b/src/components/column/Column.vue
@@ -77,8 +77,8 @@ export default {
rowReorder: {
type: Boolean,
default: false
- }
- ,rowReorderIcon: {
+ },
+ rowReorderIcon: {
type: String,
default: 'pi pi-bars'
},
diff --git a/src/components/columngroup/ColumnGroup.d.ts b/src/components/columngroup/ColumnGroup.d.ts
new file mode 100644
index 000000000..628f9d8e0
--- /dev/null
+++ b/src/components/columngroup/ColumnGroup.d.ts
@@ -0,0 +1,5 @@
+import Vue from 'vue';
+
+export declare class ColumnGroup extends Vue {
+ type?: string;
+}
\ No newline at end of file
diff --git a/src/components/datatable/DataTable.d.ts b/src/components/datatable/DataTable.d.ts
index 5924f4246..59925dcf4 100644
--- a/src/components/datatable/DataTable.d.ts
+++ b/src/components/datatable/DataTable.d.ts
@@ -34,12 +34,15 @@ export declare class DataTable extends Vue {
autoLayout?: boolean;
resizableColumns?: boolean;
columnResizeMode?: string;
+ reorderableColumns?: boolean;
$emit(eventName: 'page', event: Event): this;
$emit(eventName: 'sort', event: Event): this;
$emit(eventName: 'filter', event: Event): this;
$emit(eventName: 'row-select', event: Event): this;
$emit(eventName: 'row-unselect', event: Event): this;
$emit(eventName: 'column-resize-end', event: Event): this;
+ $emit(eventName: 'column-reorder', event: Event): this;
+ $emit(eventName: 'row-reorder', event: Event): this;
$slots: {
header: VNode[];
paginatorLeft: VNode[];
diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue
index 68e1c5e60..11f232e54 100644
--- a/src/components/datatable/DataTable.vue
+++ b/src/components/datatable/DataTable.vue
@@ -1058,10 +1058,10 @@ export default {
if (allowDrop) {
ObjectUtils.reorderArray(this.columnOrder, dragIndex, dropIndex);
- this.$emit('col-reorder', {
+ this.$emit('column-reorder', {
+ originalEvent: event,
dragIndex: dragIndex,
- dropIndex: dropIndex,
- columns: this.columns
+ dropIndex: dropIndex
});
}
@@ -1163,6 +1163,7 @@ export default {
ObjectUtils.reorderArray(processedData, this.draggedRowIndex, dropIndex);
this.$emit('row-reorder', {
+ originalEvent: event,
dragIndex: this.draggedRowIndex,
dropIndex: dropIndex,
value: processedData
diff --git a/src/views/datatable/DataTableDoc.vue b/src/views/datatable/DataTableDoc.vue
index 8fee3e421..fa723fb00 100644
--- a/src/views/datatable/DataTableDoc.vue
+++ b/src/views/datatable/DataTableDoc.vue
@@ -6,6 +6,7 @@
Columns can be grouped at header and footer sections by defining a ColumnGroup with nested rows and columns.
+Columns can be reordered using drag drop by setting the reorderableColumns to true. column-reorder is a callback that is invoked when a column is reordered. + DataTable keeps the column order state internally using keys that identifies a column using the field property. If the column has no field, use columnKey instead.
+Data can be reordered using drag drop by adding a reorder column that will display an icon as a drag handle. + "row-reorder" is a mandatory callback that is invoked when a column is reordered, use this event to update the new order. Note that the reorder icon can be customized using rowReorderIcon of the column component.
+