- saving progress;
This commit is contained in:
45
src/components/DataTableAsync/DataTableAsync.js
Normal file
45
src/components/DataTableAsync/DataTableAsync.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
|
||||||
|
import translationStrings from '../../translationStringsForComponents';
|
||||||
|
|
||||||
|
const DataTableAsync = ({
|
||||||
|
items = [],
|
||||||
|
totalRecordsNum = 0,
|
||||||
|
isLoading = false,
|
||||||
|
onPageChangeFn = () => {
|
||||||
|
}
|
||||||
|
}) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items}
|
||||||
|
paginator
|
||||||
|
showGridlines
|
||||||
|
lazy
|
||||||
|
totalRecords={totalRecordsNum}
|
||||||
|
onPage={onPageChangeFn}
|
||||||
|
rows={5}
|
||||||
|
loading={isLoading}
|
||||||
|
dataKey="id"
|
||||||
|
filters={filters}
|
||||||
|
stripedRows
|
||||||
|
removableSort
|
||||||
|
header={header}
|
||||||
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column field="name"
|
||||||
|
header={__('Nome Bando', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DataTableAsync;
|
||||||
Reference in New Issue
Block a user