Skip to main content

useRecordsAll

Beta API, possible future changes.

Get all the records in the datasheet. Rerendering is triggered when the value of record, view configuration, or field configuration changes. Get all the records may cause lag due to a sharp increase in computation, so please use caution and test well.

Parameters

NameType
datasheet?Datasheet

Returns

Record[]

Example

import { useRecordsAll, useDatasheet } from '@apitable/widget-sdk';

// Show record title
function RecordsTitle() {
const records = useRecordsAll();
return (<div>
{records.map(record => <p>{record.title}</p>)}
</div>);
}

// Show the primary key of records the corresponding to the datasheetId(dstXXXXXXXX) datasheet
function DatasheetRecordsTitle() {
const useDatasheet = useDatasheet('dstXXXXXXXX');
const records = useRecordsAll(useDatasheet);
return (<div>
{records.map(record => <p>{record.title}</p>)}
</div>);
}