{
- const value = e.value as Product;
- setSelectedProduct(value);
- }} dataKey="id" isDataSelectable={isRowSelectable} rowClassName={rowClassName} tableStyle={{ minWidth: '50rem' }}>
+ onSelectionChange={(e) => setSelectedProduct(e.value)} dataKey="id" isDataSelectable={isRowSelectable} rowClassName={rowClassName} tableStyle={{ minWidth: '50rem' }}>
diff --git a/components/doc/datatable/rowselection/eventsdoc.js b/components/doc/datatable/rowselection/eventsdoc.js
index 9f22f3ff3a..0ffb299313 100644
--- a/components/doc/datatable/rowselection/eventsdoc.js
+++ b/components/doc/datatable/rowselection/eventsdoc.js
@@ -79,16 +79,16 @@ import { Toast } from 'primereact/toast';
import { ProductService } from './service/ProductService';
interface Product {
- id: string;
- code: string;
- name: string;
- description: string;
- image: string;
- price: number;
- category: string;
- quantity: number;
- inventoryStatus: string;
- rating: number;
+ id?: string;
+ code?: string;
+ name?: string;
+ description?: string;
+ image?: string;
+ price?: number;
+ category?: string;
+ quantity?: number;
+ inventoryStatus?: string;
+ rating?: number;
}
export default function RowSelectEventsDemo() {
@@ -112,10 +112,7 @@ export default function RowSelectEventsDemo() {
{
- const value = e.value as Product;
- setSelectedProduct(value);
- }} dataKey="id" onRowSelect={onRowSelect} onRowUnselect={onRowUnselect} metaKeySelection={false} tableStyle={{ minWidth: '50rem' }}>
+ onSelectionChange={(e) => setSelectedProduct(e.value)} dataKey="id" onRowSelect={onRowSelect} onRowUnselect={onRowUnselect} metaKeySelection={false} tableStyle={{ minWidth: '50rem' }}>
diff --git a/components/doc/datatable/rowselection/multipledoc.js b/components/doc/datatable/rowselection/multipledoc.js
index 353cd86917..035c772d1c 100644
--- a/components/doc/datatable/rowselection/multipledoc.js
+++ b/components/doc/datatable/rowselection/multipledoc.js
@@ -68,16 +68,16 @@ import { InputSwitch, InputSwitchChangeEvent } from 'primereact/inputswitch';
import { ProductService } from './service/ProductService';
interface Product {
- id: string;
- code: string;
- name: string;
- description: string;
- image: string;
- price: number;
- category: string;
- quantity: number;
- inventoryStatus: string;
- rating: number;
+ id?: string;
+ code?: string;
+ name?: string;
+ description?: string;
+ image?: string;
+ price?: number;
+ category?: string;
+ quantity?: number;
+ inventoryStatus?: string;
+ rating?: number;
}
export default function MultipleRowsSelectionDemo() {
@@ -96,11 +96,7 @@ export default function MultipleRowsSelectionDemo() {
{
- if (Array.isArray(e.value)) {
- setSelectedProducts(e.value);
- }
- }}
+ onSelectionChange={(e) => setSelectedProducts(e.value)}
dataKey="id" metaKeySelection={metaKey} dragSelection tableStyle={{ minWidth: '50rem' }}>
diff --git a/components/doc/datatable/rowselection/radiobuttondoc.js b/components/doc/datatable/rowselection/radiobuttondoc.js
index f86e848245..844bddda60 100644
--- a/components/doc/datatable/rowselection/radiobuttondoc.js
+++ b/components/doc/datatable/rowselection/radiobuttondoc.js
@@ -68,16 +68,16 @@ import { InputSwitch, InputSwitchChangeEvent } from 'primereact/inputswitch';
import { ProductService } from './service/ProductService';
interface Product {
- id: string;
- code: string;
- name: string;
- description: string;
- image: string;
- price: number;
- category: string;
- quantity: number;
- inventoryStatus: string;
- rating: number;
+ id?: string;
+ code?: string;
+ name?: string;
+ description?: string;
+ image?: string;
+ price?: number;
+ category?: string;
+ quantity?: number;
+ inventoryStatus?: string;
+ rating?: number;
}
export default function RadioButtonRowSelectionDemo() {
@@ -96,10 +96,7 @@ export default function RadioButtonRowSelectionDemo() {