Skip to content

Commit

Permalink
aggrid 组件onDataFilter中传入当前组件ref属性,用于支持dispatchEvent功能
Browse files Browse the repository at this point in the history
  • Loading branch information
yinlianghui committed Dec 13, 2024
1 parent 9cef768 commit cee8512
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/@steedos-widgets/ag-grid/src/components/AgGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 殷亮辉 [email protected]
* @Date: 2024-01-18 18:58:37
* @LastEditors: 殷亮辉 [email protected]
* @LastEditTime: 2024-12-07 21:22:35
* @LastEditTime: 2024-12-12 17:36:50
*/
import React, { useEffect, useState, useRef } from 'react';
import { AG_GRID_LOCALE_CN } from '@ag-grid-community/locale';
Expand All @@ -25,15 +25,15 @@ export const AmisAgGrid = (props: any) => {
let onDataFilter = null;

if (typeof dataFilter === 'string') {
onDataFilter = new Function('config', 'AgGrid', 'props', 'data', 'return (async () => { ' + dataFilter + ' })()')
onDataFilter = new Function('config', 'AgGrid', 'props', 'data', 'ref', 'return (async () => { ' + dataFilter + ' })()')
}

useEffect(() => {
let isCancelled = false;
(async () => {
try {
if (onDataFilter) {
const newConfig = await onDataFilter(config, agGrid, props, amisData);
const newConfig = await onDataFilter(config, agGrid, props, amisData, wrapperRef);
if (!isCancelled) {
setConfig(newConfig || config);
setDataFilterLoaded(true);
Expand Down

0 comments on commit cee8512

Please sign in to comment.