goox
November 20, 2020, 5:06pm
1
I’m updating my code to upgrade from the deprecated setPanelEditor, to setPanelOptions.
With setPanelOptions, is it still possible to get event like onChange
or onClick
when the user changes a setting or click on a button?
Typically, that’s what I was doing with setPanelEditor:
<HorizontalGroup>
<IconButton
name="trash-alt"
size="xl"
surface="panel"
onClick={event => this.onDeleteItem(event, index)}
/>
<IconButton name="copy" size="xl" surface="panel" onClick= {event => this.onCloneItem(event, oneItem)} />
</HorizontalGroup>
Thanks
The panel options editors are bound to the property in the panel options interface, which means that Grafana handles the changes for you.
If you want to handle the changes yourself, you can build a custom editor. See here for an example:
category: ['Dimensions'], settings: { filterByType: FieldType.string, }, }) .addCustomEditor({ id: 'sizeField', path: 'sizeField', name: 'Size', description: 'Field to use for size. Defaults to the first numeric field.', editor: FieldSelectEditor, category: ['Dimensions'], settings: { filterByType: FieldType.number, }, }) .addCustomEditor({ id: 'colorField', path: 'colorField', name: 'Color', description: