diff --git a/components/doc/overlaypanel/datatabledoc.js b/components/doc/overlaypanel/datatabledoc.js index fafe59195c..52297d1885 100644 --- a/components/doc/overlaypanel/datatabledoc.js +++ b/components/doc/overlaypanel/datatabledoc.js @@ -29,12 +29,10 @@ export function DataTableDoc(props) { const toast = useRef(null); const isMounted = useRef(false); - useEffect(() => { - if (isMounted.current && selectedProduct) { - op.current.hide(); - toast.current.show({ severity: 'info', summary: 'Product Selected', detail: selectedProduct.name, life: 3000 }); - } - }, [selectedProduct]); // eslint-disable-line react-hooks/exhaustive-deps + const productSelect = (e) => { + op.current.hide(); + toast.current.show({ severity: 'info', summary: 'Product Selected', detail: e.data.name, life: 3000 }); + }; useEffect(() => { isMounted.current = true; @@ -99,12 +97,10 @@ export default function DataTableDemo() { const toast = useRef(null); const isMounted = useRef(false); - useEffect(() => { - if (isMounted.current && selectedProduct) { - op.current.hide(); - toast.current.show({ severity: 'info', summary: 'Product Selected', detail: selectedProduct.name, life: 3000 }); - } - }, [selectedProduct]); + const productSelect = (e) => { + op.current.hide(); + toast.current.show({ severity: 'info', summary: 'Product Selected', detail:e.data.name, life: 3000 }); + }; useEffect(() => { isMounted.current = true; @@ -133,11 +129,11 @@ export default function DataTableDemo() {