diff --git a/packages/angular b/packages/angular
index 6c510459..5e68f981 160000
--- a/packages/angular
+++ b/packages/angular
@@ -1 +1 @@
-Subproject commit 6c5104596e6deb2b78f65fa034fca39aaec4890c
+Subproject commit 5e68f981ecf414a32ab92c094775d9040606cc37
diff --git a/packages/svelte b/packages/svelte
index af2efb76..902a340e 160000
--- a/packages/svelte
+++ b/packages/svelte
@@ -1 +1 @@
-Subproject commit af2efb76ce4bbc341de13d73b50b10265d9c62df
+Subproject commit 902a340e64496addebe885518b8275fcc91034fc
diff --git a/packages/vue2 b/packages/vue2
index 7272f8e6..e6bcd15f 160000
--- a/packages/vue2
+++ b/packages/vue2
@@ -1 +1 @@
-Subproject commit 7272f8e6f936faecd188ce2836997642916f7d43
+Subproject commit e6bcd15f963d9343d4e94190b89bdeebe61aaaa5
diff --git a/packages/vue3 b/packages/vue3
index 26def6a8..9c565397 160000
--- a/packages/vue3
+++ b/packages/vue3
@@ -1 +1 @@
-Subproject commit 26def6a805a3225e509a56d27a5cccd499014661
+Subproject commit 9c565397d0c4614ae633b9642db89fdefdee0259
diff --git a/src/components.d.ts b/src/components.d.ts
index c639a078..25f3e2fe 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -9,7 +9,7 @@ import { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEven
import { GridPlugin } from "./plugins/base.plugin";
import { AutoSizeColumnConfig } from "./plugins/column.auto-size.plugin";
import { ColumnFilterConfig, FilterCaptions, FilterCollectionItem, LogicFunction, MultiFilterItem, ShowData } from "./plugins/filter/filter.types";
-import { SortingConfig } from "./plugins/sorting/sorting.types";
+import { SortingConfig, SortingOrder } from "./plugins";
import { GroupingOptions } from "./plugins/groupingRow/grouping.row.types";
import { VNode } from "@stencil/core";
import { FocusedData } from "./components/revoGrid/viewport.service";
@@ -24,7 +24,7 @@ export { AfterEditEvent, AllDimensionType, ApplyFocusEvent, BeforeCellRenderEven
export { GridPlugin } from "./plugins/base.plugin";
export { AutoSizeColumnConfig } from "./plugins/column.auto-size.plugin";
export { ColumnFilterConfig, FilterCaptions, FilterCollectionItem, LogicFunction, MultiFilterItem, ShowData } from "./plugins/filter/filter.types";
-export { SortingConfig } from "./plugins/sorting/sorting.types";
+export { SortingConfig, SortingOrder } from "./plugins";
export { GroupingOptions } from "./plugins/groupingRow/grouping.row.types";
export { VNode } from "@stencil/core";
export { FocusedData } from "./components/revoGrid/viewport.service";
@@ -791,12 +791,16 @@ declare global {
"beforerange": ChangedRange;
"afterfocus": FocusAfterRenderEvent;
"roworderchanged": { from: number; to: number };
- "beforesortingapply": {
+ "beforesorting": {
column: ColumnRegular;
order: 'desc' | 'asc';
additive: boolean;
};
- "beforesorting": {
+ "beforesourcesortingapply": {
+ type: DimensionRows;
+ sorting?: SortingOrder;
+ };
+ "beforesortingapply": {
column: ColumnRegular;
order: 'desc' | 'asc';
additive: boolean;
@@ -1471,7 +1475,7 @@ declare namespace LocalJSX {
*/
"onBeforerowdefinition"?: (event: RevoGridCustomEvent<{ vals: any; oldVals: any }>) => void;
/**
- * By sorting.plugin.ts Before sorting event. Initial sorting triggered, if this event stops no other event called. Use e.preventDefault() to prevent sorting.
+ * By `sorting.plugin.ts`
Triggered immediately after header click.
First in sorting event sequence. Ff this event stops no other event called.
Use `e.preventDefault()` to prevent sorting.
*/
"onBeforesorting"?: (event: RevoGridCustomEvent<{
column: ColumnRegular;
@@ -1479,7 +1483,7 @@ declare namespace LocalJSX {
additive: boolean;
}>) => void;
/**
- * By sorting.plugin.ts Before sorting apply. Use e.preventDefault() to prevent sorting data change.
+ * By `sorting.plugin.ts`
After `beforesorting`
Triggered after column data updated with new sorting order.
Use `e.preventDefault()` to prevent sorting data change.
*/
"onBeforesortingapply"?: (event: RevoGridCustomEvent<{
column: ColumnRegular;
@@ -1492,6 +1496,13 @@ declare namespace LocalJSX {
"onBeforesourceset"?: (event: RevoGridCustomEvent<{
type: DimensionRows;
source: DataType[];
+ }>) => void;
+ /**
+ * By `sorting.plugin.ts`
Same as `beforesorting` but triggered after `beforeanysource` (when source is changed).
Use `e.preventDefault()` to prevent sorting data change.
+ */
+ "onBeforesourcesortingapply"?: (event: RevoGridCustomEvent<{
+ type: DimensionRows;
+ sorting?: SortingOrder;
}>) => void;
/**
* Emitted before trimming values. Use e.preventDefault() to prevent the default behavior of trimming values. Modify the `trimmed` property if you want to filter the indexes for trimming.
diff --git a/src/components/revoGrid/revo-grid.tsx b/src/components/revoGrid/revo-grid.tsx
index 205e3c69..53d6b020 100644
--- a/src/components/revoGrid/revo-grid.tsx
+++ b/src/components/revoGrid/revo-grid.tsx
@@ -85,7 +85,7 @@ import { ColumnCollection, getColumnByProp, getColumns } from '../../utils/colum
import { WCAGPlugin } from '../../plugins/wcag';
import { ColumnFilterConfig, FilterCollectionItem } from '../../plugins/filter/filter.types';
import { PluginService } from './plugin.service';
-import { SortingConfig } from 'src/plugins/sorting/sorting.types';
+import { SortingConfig, SortingOrder } from '../../plugins';
/**
@@ -369,23 +369,34 @@ export class RevoGridComponent {
@Event() roworderchanged: EventEmitter<{ from: number; to: number }>;
/**
- * By sorting.plugin.ts
- * Before sorting apply.
- * Use e.preventDefault() to prevent sorting data change.
+ * By `sorting.plugin.ts`
+ *
Triggered immediately after header click.
+ *
First in sorting event sequence. Ff this event stops no other event called.
+ *
Use `e.preventDefault()` to prevent sorting.
*/
- @Event() beforesortingapply: EventEmitter<{
+ @Event() beforesorting: EventEmitter<{
column: ColumnRegular;
order: 'desc' | 'asc';
additive: boolean;
}>;
/**
- * By sorting.plugin.ts
- * Before sorting event.
- * Initial sorting triggered, if this event stops no other event called.
- * Use e.preventDefault() to prevent sorting.
+ * By `sorting.plugin.ts`
+ *
Same as `beforesorting` but triggered after `beforeanysource` (when source is changed).
+ *
Use `e.preventDefault()` to prevent sorting data change.
*/
- @Event() beforesorting: EventEmitter<{
+ @Event() beforesourcesortingapply: EventEmitter<{
+ type: DimensionRows;
+ sorting?: SortingOrder;
+ }>;
+
+ /**
+ * By `sorting.plugin.ts`
+ *
After `beforesorting`
+ *
Triggered after column data updated with new sorting order.
+ *
Use `e.preventDefault()` to prevent sorting data change.
+ */
+ @Event() beforesortingapply: EventEmitter<{
column: ColumnRegular;
order: 'desc' | 'asc';
additive: boolean;
diff --git a/src/plugins/sorting/sorting.plugin.ts b/src/plugins/sorting/sorting.plugin.ts
index 045c4c39..2e77af5b 100644
--- a/src/plugins/sorting/sorting.plugin.ts
+++ b/src/plugins/sorting/sorting.plugin.ts
@@ -16,9 +16,12 @@ import { getCellRaw, getColumnByProp } from '../../utils/column.utils';
import { rowTypes } from '@store';
import { sortIndexByItems } from './sorting.func';
+export * from './sorting.types';
+
/**
* Lifecycle
* 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
+ * 1.1. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
* 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
* 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
* 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
@@ -84,8 +87,8 @@ export class SortingPlugin extends BasePlugin {
}) => {
// if sorting was provided - sort data
if (!!this.sorting && this.sortingFunc) {
- const beforeEvent = this.emit('beforesorting', { type });
- if (beforeEvent.defaultPrevented) {
+ const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
+ if (event.defaultPrevented) {
return;
}
this.startSorting(this.sorting, this.sortingFunc);
diff --git a/src/types/events.ts b/src/types/events.ts
index 4fe43b2f..3e924486 100644
--- a/src/types/events.ts
+++ b/src/types/events.ts
@@ -7,8 +7,9 @@ export type RevogridEvents = 'contentsizechanged'|
'beforerange'|
'afterfocus'|
'roworderchanged'|
- 'beforesortingapply'|
'beforesorting'|
+ 'beforesourcesortingapply'|
+ 'beforesortingapply'|
'rowdragstart'|
'headerclick'|
'beforecellfocus'|
@@ -113,8 +114,9 @@ export const REVOGRID_EVENTS = new Map([
['beforerange', 'beforerange'],
['afterfocus', 'afterfocus'],
['roworderchanged', 'roworderchanged'],
- ['beforesortingapply', 'beforesortingapply'],
['beforesorting', 'beforesorting'],
+ ['beforesourcesortingapply', 'beforesourcesortingapply'],
+ ['beforesortingapply', 'beforesortingapply'],
['rowdragstart', 'rowdragstart'],
['headerclick', 'headerclick'],
['beforecellfocus', 'beforecellfocus'],