Zum Hauptinhalt springen

CreateReactGadgetOptions

CreateReactGadgetOptions<TOptions, TGadget> = object

Type Parameters

TOptions

TOptions extends object

TGadget

TGadget extends TargetGadgetInstance

Properties

gadgetName

gadgetName: string

The name of the React component to be rendered. Has to be a component that is available in the uiComponents package.


gadgetOptions?

optional gadgetOptions: TOptions

Options to be passed to the React component. These options are passed as props to the component.

Default

{}

id?

optional id: string

The id of the HTML element where the React component will be rendered. The gadgetOptions.id alaways has precedence over this id. If neither is set, a unique id will be generated.

Default

"react-gadget-<unique-id>"

htmlInstance?

optional htmlInstance: TGadget

The HTML instance to be used. If not provided, a new HTML instance will be created.

Default

otris.gadget.gui.HTML instance from gadgetAPI.getHTMLInstance()

containerStyle?

optional containerStyle: string

Additional CSS styles to be applied to the container of the React component.

Default

""

containerClass?

optional containerClass: string

Additional CSS classes to be applied to the container of the React component.

Default

""

onLoadCallback()?

optional onLoadCallback: (data) => void

Callback function that is called before the React component is rendered in the client. The data passed to the callback is the same as the props then passed to the React component.

Parameters

data

TOptions

Returns

void

Default

undefined

Example

onLoadCallback: (data) => {
const rows = getRowsFromSomewhere();
data.rows = rows;
}