-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 10.10
-
Fix Version/s: 10.10-HF06, 11.1, 2021.0
-
Component/s: Layouts & Widgets, Web UI
-
Release Notes Summary:Observers are fired on the correct document.
-
Backlog priority:600
-
Sprint:nxGang Sprint 11.1.8
-
Story Points:2
Studio-side
- create a custom document type named documentTypeA
- create a custom document type named documentTypeB
- in Designer generate the forms
- in creation form of document A paste the following:
<!-- `nuxeo-documenttypea-create-layout` @group Nuxeo UI @element nuxeo-documenttypea-create-layout --> <dom-module id="nuxeo-documenttypea-create-layout"> <template> <style> *[role=widget] { padding: 5px; } </style> <nuxeo-input role="widget" value="{{document.properties.dc:title}}" label="Title" type="text"></nuxeo-input> <nuxeo-input role="widget" value="{{document.properties.dc:description}}" label="Description" type="text"></nuxeo-input> </template> <script> Polymer({ is: 'nuxeo-documenttypea-create-layout', behaviors: [Nuxeo.LayoutBehavior], properties: { /** * @doctype documentTypeA */ document: { type: Object, observer: '_observeDocA' }, }, _observeDocA: function() { console.log("observer type A") } }); </script> </dom-module>
- in creation form of document B paste the following:
<!-- `nuxeo-documenttypeb-create-layout` @group Nuxeo UI @element nuxeo-documenttypeb-create-layout --> <dom-module id="nuxeo-documenttypeb-create-layout"> <template> <style> *[role=widget] { padding: 5px; } </style> <nuxeo-input role="widget" value="{{document.properties.dc:title}}" label="Title" type="text"></nuxeo-input> <nuxeo-input role="widget" value="{{document.properties.dc:description}}" label="Description" type="text"></nuxeo-input> </template> <script> Polymer({ is: 'nuxeo-documenttypeb-create-layout', behaviors: [Nuxeo.LayoutBehavior], properties: { /** * @doctype documentTypeB */ document: { type: Object, observer: '_observeDocB' }, }, _observeDocB: function() { console.log("observer type B") } }); </script> </dom-module>
- save the project
Server-side
- create a workspace
- open google inspector
- in google inspector click the console tab
- in google inspector clear the console logs
- in webui click the + sign and select documentTypeA
- observe the console logs show observer type A
- close the form and observe another line showing observer type A
- click the + sign and select documentTypeB
- observe the console logs show observer type A and observer type B
- close the form and observe another line showing observer type B
- click the + sign and select documentTypeB again
- observe the console logs show observer type B and observer type B (see consoleLogs.png)
Expected behavior: the observer should be triggered only once when opening the form and only the right one (observerDocA for type A and observerDocB for type B)
- split from
-
ELEMENTS-863 Observer fires when it should not
- Resolved
- Is referenced in