Skip to main content

useViewsMeta

Beta API, possible feature changes.

Get the metadata property of the all views. Rerendering is triggered when the order of views changes or the metadata property changes.

Parameters

NameType
datasheet?Datasheet

Returns

IViewMeta[]

Example

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

// Show all views name
function ViewNames() {
const viewsMeta = useViewsMeta();
return (<div>
{viewsMeta.map(viewMeta => <p>View names: {viewMeta.name}</p>)}
</div>);
}

// Show the names of all views corresponding to the datasheetId(dstXXXXXXXX) datasheet
function DatasheetViewNames() {
const datasheet = useDatasheet('dstXXXXXXXX');
const viewsMeta = useViewsMeta(datasheet);
return (<div>
{viewsMeta.map(viewMeta => <p>View names: {viewMeta.name}</p>)}
</div>);
}