Skip to content
Extraits de code Groupes Projets
Valider a290c4b1 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[FIX] json viewer widget error

parent dc8527b0
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
import {registry} from "@web/core/registry"; import {registry} from "@web/core/registry";
import {loadJS} from "@web/core/assets"; import {loadJS} from "@web/core/assets";
import {Component, onWillStart, useEffect, useRef} from "@odoo/owl"; import {Component, onWillStart, useEffect, useRef} from "@odoo/owl";
import { standardFieldProps } from '@web/views/fields/standard_field_props';
class JsonWidget extends Component { class JsonWidget extends Component {
static template = "api_connector.JsonWidgetField";
static props = { ...standardFieldProps };
setup() { setup() {
this.json_tree = null; this.json_tree = null;
this.divRef = useRef("json_response"); this.divRef = useRef("json_response");
...@@ -26,12 +29,14 @@ class JsonWidget extends Component { ...@@ -26,12 +29,14 @@ class JsonWidget extends Component {
if (this.json_tree) { if (this.json_tree) {
this.json_tree.destroy(); this.json_tree.destroy();
} }
const tree = jsonview.create(this.props.value); const tree = jsonview.create(this.props.record.data[this.props.name]);
this.json_tree = jsonview.render(tree, this.divRef.el); this.json_tree = jsonview.render(tree, this.divRef.el);
jsonview.expand(tree); jsonview.expand(tree);
} }
} }
JsonWidget.template = "api_connector.JsonWidgetField";
registry.category("fields").add("json_viewer", JsonWidget);
export default JsonWidget; export const jsonWidget = {
component: JsonWidget,
};
registry.category("fields").add("json_viewer", jsonWidget);
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter