mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 21:26:43 +00:00
Panel mixin js load (#393)
* Update panel.md Add few words about javascript integration for PanelMixin inhertance * Update panel.md
This commit is contained in:
parent
1f6b30faa0
commit
82b773b63f
@ -33,6 +33,25 @@ In this case, the template can then be loaded (from any plugin!) by loading "myp
|
||||
|
||||
Custom code can be provided which will run when the particular panel is first loaded (by selecting it from the side menu).
|
||||
|
||||
To add some javascript code, you can add a reference to a function that will be called when the panel is loaded with the 'javascript' key in the panel description :
|
||||
```
|
||||
{
|
||||
'title': "Updates",
|
||||
'description': "Latest updates for this part",
|
||||
'javascript': 'alert("You just loaded this panel!")',
|
||||
}
|
||||
```
|
||||
|
||||
Or to add a template file that will be renderered as javascript code, from the plugin template folder, whith the 'javascript_template' key in the panel description :
|
||||
```
|
||||
{
|
||||
'title': "Updates",
|
||||
'description': "Latest updates for this part",
|
||||
'javascript_template': 'pluginTemplatePath/myJavascriptFile.js',
|
||||
}
|
||||
```
|
||||
note : see convention for template directory above.
|
||||
|
||||
## Example Implementation
|
||||
|
||||
Refer to the `CustomPanelSample` example class in the `./plugin/samples/integration/` directory, for a fully worked example of how custom UI panels can be implemented.
|
||||
|
Loading…
x
Reference in New Issue
Block a user