Code: Select all
<DataTable value={this.state.cars} expandedRows={this.state.expandedRows} onRowToggle={(e) => this.setState({expandedRows:e.data})}
rowExpansionTemplate={this.rowExpansionTemplate}>
<Column expander={true} style={{width: '2em'}} />
<Column field="vin" header="Vin" />
<Column field="year" header="Year" />
<Column field="brand" header="Brand" />
<Column field="color" header="Color" />
</DataTable>
Code: Select all
TS2322: Type '{ value: any; expandedRows: any[]; onRowToggle: (e: any) => void; rowExpansionTemplate: () => Ele...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<DataTable> & Readonly<{ children?: ReactNode; }> &...'.
Type '{ value: any; expandedRows: any[]; onRowToggle: (e: any) => void; rowExpansionTemplate: () => Ele...' is not assignable to type 'Readonly<DataTableProps>'.
Types of property 'onRowToggle' are incompatible.
Type '(e: any) => void' is not assignable to type '(() => void) | undefined'.
Type '(e: any) => void' is not assignable to type '() => void'.
Code: Select all
TS2322: Type '{ value: any; expandedRows: any[]; onRowToggle: () => void; rowExpansionTemplate: (data: any) => ...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<DataTable> & Readonly<{ children?: ReactNode; }> &...'.
Type '{ value: any; expandedRows: any[]; onRowToggle: () => void; rowExpansionTemplate: (data: any) => ...' is not assignable to type 'Readonly<DataTableProps>'.
Types of property 'rowExpansionTemplate' are incompatible.
Type '(data: any) => Element' is not assignable to type '(() => void) | undefined'.
Type '(data: any) => Element' is not assignable to type '() => void'.
-Ross