And in the media-tree-item.element.js I changed the elementName to avoid this error : "NotSupportedError: Failed to execute 'define' on 'CustomElementRegistry': the name "umb-media-tree-item" has already been used with this registry"
This works, i'm getting my new ui elements that I define in media-tree-item.element.ts and getting my new properties that i fill in the media-tree.server.data-source.ts
Problem: Sometimes it works, and sometimes it doesn't. If I refresh the page, my code occasionally appears, but other times the default Umbraco behavior is displayed.
I always have this error in the console : "Umb.Repository.Media.Tree is already registered" that i can fix changing alias: 'Umb.Repository.Media.Tree', to alias: 'Umb.Repository.Media.Tree-V2' but in that case my code stops works.
Solution Found.
The problem was that sometime my class register first, and in this case there wasn't any problem. (Just the error in the console). The problem was when the umbraco original class register first, than my class would not be register, and would not work.
Umbraco 14 Override Media Tree UI and Datasource
I want to customize the Media Tree (modify its UI) and add additional properties to the data source. I have achieved this in the following way:
And in the media-tree-item.element.js I changed the elementName to avoid this error : "NotSupportedError: Failed to execute 'define' on 'CustomElementRegistry': the name "umb-media-tree-item" has already been used with this registry"
This works, i'm getting my new ui elements that I define in media-tree-item.element.ts and getting my new properties that i fill in the media-tree.server.data-source.ts
Problem: Sometimes it works, and sometimes it doesn't. If I refresh the page, my code occasionally appears, but other times the default Umbraco behavior is displayed.
I always have this error in the console : "Umb.Repository.Media.Tree is already registered" that i can fix changing alias: 'Umb.Repository.Media.Tree', to alias: 'Umb.Repository.Media.Tree-V2' but in that case my code stops works.
Thanks in advance.
Solution Found. The problem was that sometime my class register first, and in this case there wasn't any problem. (Just the error in the console). The problem was when the umbraco original class register first, than my class would not be register, and would not work.
The solution is to unregister first:
is working on a reply...