Skip to content

Commit

Permalink
Fix #6501: Datatable expose sorts and filters in ref (#6533)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored May 1, 2024
1 parent ba99e3e commit 1b70954
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,10 @@ export const DataTable = React.forwardRef((inProps, ref) => {
restoreState,
restoreTableState,
saveState,
getFilterMeta: () => filtersState,
setFilterMeta: (filters) => setFiltersState(filters),
getSortMeta: () => multiSortMetaState,
setSortMeta: (sorts) => setMultiSortMetaState(sorts),
getElement: () => elementRef.current,
getTable: () => tableRef.current,
getVirtualScroller: () => virtualScrollerRef.current
Expand Down
22 changes: 22 additions & 0 deletions components/lib/datatable/datatable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,28 @@ export declare class DataTable<TValue extends DataTableValueArray> extends React
* Saves the state.
*/
public saveState(): void;
/**
* Retrieves the currently applied filters for the data table.
* @returns {DataTableFilterMeta | undefined} The currently applied filters, if any, or undefined if no filters are set.
*/
public getFilterMeta(): DataTableFilterMeta | undefined;
/**
* Sets the filters for the data table.
* @param {DataTableFilterMeta} filters - The filters to be applied to the data table.
* @returns {void}
*/
public setFilterMeta(filters: DataTableFilterMeta): void;
/**
* Retrieves the currently applied multiple sort metadata for the data table.
* @returns {DataTableSortMeta[] | undefined} The currently applied sorts, if any, or undefined if no sorts are set.
*/
public getSortMeta(): DataTableSortMeta[] | undefined;
/**
* Sets the multiple sort metadata for the data table.
* @param {DataTableSortMeta[]} sorts - The sorts to be applied to the data table.
* @returns {void}
*/
public setSortMeta(sorts: DataTableSortMeta[]): void;
/**
* Used to get container element.
* @return {HTMLDivElement} Container element
Expand Down

0 comments on commit 1b70954

Please sign in to comment.