FieldPicker
A field selector component that can select the fields inside the corresponding view ID.
Parameters
Name | Type |
---|---|
props | IFieldPicker |
Returns
Element
Example
Common usage.
import React, { useState } from 'react';
import { FieldPicker, useActiveViewId } from '@apitable/widget-sdk';
const Example = () => {
const viewId = useActiveViewId();
const [fieldId, setFieldId] = useState()
return <FieldPicker viewId={viewId} fieldId={fieldId} onChange={option => setFieldId(option.value)} />
}
Use useCloudStorage implementing persistent storage.
import React, { useState } from 'react';
import { FieldPicker, useActiveViewId, useCloudStorage } from '@apitable/widget-sdk';
const ExampleCloud = () => {
const viewId = useActiveViewId();
const [fieldId, setFieldId] = useCloudStorage('selectFieldId');
return <FieldPicker viewId={viewId} fieldId={fieldId} onChange={option => setFieldId(option.value)} />;
};