useRecord
Gets information of a specified record. Rerendering is triggered when the value of record, field property changes.
If not ID is passed in, undefined is returned.
Parameters
Name | Type | Description |
---|---|---|
recordId | string | undefined | The ID for this record. |
Returns
DynamicRecord
Example
import { useRecord } from '@apitable/widget-sdk';
// Show record title
function RecordTitle() {
const record = useRecord('recXXXXXXX');
return <p>{record.title}</p>
}
▸ useRecord(datasheet
, recordId
): DynamicRecord
Support for loading the corresponding datasheet data record.
Parameters
Name | Type | Description |
---|---|---|
datasheet | Datasheet | Datasheet instance, by useDatasheet get. |
recordId | string | undefined | The ID for this record. |
Returns
DynamicRecord
Example
import { useRecord, useDatasheet } from '@apitable/widget-sdk';
// Show the primary key of record the corresponding to the datasheetId(dstXXXXXXXX) datasheet
function RecordTitle() {
const datasheet = useDatasheet('dstXXXXXXXX);
const record = useRecord('recXXXXXXX');
return <p>{record.title}</p>
}