useViewIds
Gets the ID of all view of the currently datasheet. Rerendering is triggered when the number of views changes.
Parameters
Name | Type |
---|---|
datasheet? | Datasheet |
Returns
string
[]
Example
import { useViewIds, useDatasheet } from '@apitable/widget-sdk';
// Display the total number of views
function ViewCount() {
const viewIds = useViewIds();
return <p>There are currently {viewIds.length} views</p>;
}
// Displays the total number of views corresponding to the datasheetId(dstXXXXXXXX) datasheet
function DatasheetViewCount() {
const datasheet = useDatasheet('dstXXXXXXXX');
const viewIds = useViewIds(datasheet);
return <p>There are currently {viewIds.length} views</p>;
}