This module includes UI controls implemented as React components.
To be able to use these controls the CanKingDataProvider component must be present in the
component tree above your component. Normally the CanKingDataProvider is added
at the root of the component tree.
// If any data should be stored in the project file then add it to this interface interfaceIProjectViewData { // This is an example showing how to store the selected channel id to the project file channelId: string; }
// Define any default values for the project data that will be used when the component is created constdefaultProjectViewData: IProjectViewData = { channelId:'', };
functionWorkspaceView() { // Get this view's unique id from search params const [searchParams] = useSearchParams(); constidString = searchParams.get('id'); constid = idString !== null ? Number.parseInt(idString, 10) : -1;
// Use the useProjectData hook to serialize/deserialize your view data to the project const [projectData, setProjectData] = useProjectData<IProjectViewData>(id, defaultProjectViewData);
// A callback that will get the new selected channel id and save it to the project data constonChannelIdentifierChange = (channelId: string) => { constdata = { ...projectData }; data.channelId = channelId; setProjectData(data); };
return ( <FillBoxcomponent="form"> <div>Add your elements here!</div> <div>This is an example how to use the CanChannelSelectControl:</div> <CanChannelSelectControl channelIdentifier={projectData.channelId} onChannelIdentifierChange={onChannelIdentifierChange} hideSectionControl /> </FillBox> ); }
This module includes UI controls implemented as React components.
To be able to use these controls the CanKingDataProvider component must be present in the component tree above your component. Normally the CanKingDataProvider is added at the root of the component tree.
Example