chen.lin
1 天以前 209878277a178ab91d48b523265e5ffb1b8cf7e6
rsf-admin/src/page/components/StickyDataTable.jsx
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
import React, { useMemo, useRef, useEffect } from 'react';
import { DataTable, useDataTableDataContext, useTranslate } from 'react-admin';
import { TableFooter, TableRow, TableCell } from '@mui/material';
@@ -218,7 +218,21 @@
        };
    }, [bulkActionsOffsetY]);
    const containerRef = useRef(null);
    useEffect(() => {
        const el = containerRef.current;
        if (!el) return;
        const clearExpandIconAriaHidden = () => {
            el.querySelectorAll('.RaDataTable-expandIcon').forEach((btn) => btn.removeAttribute('aria-hidden'));
        };
        clearExpandIconAriaHidden();
        const mo = new MutationObserver(clearExpandIconAriaHidden);
        mo.observe(el, { attributes: true, attributeFilter: ['aria-hidden'], subtree: true });
        return () => mo.disconnect();
    }, []);
    return (
        <span ref={containerRef} style={{ display: 'contents' }}>
        <DataTable {...props} foot={footerComponent} sx={dataTableStyles}>
            {/* {processedChildren} */}
            {processedChildren
@@ -234,6 +248,7 @@
                ))
            }
        </DataTable>
        </span>
    );
};