When start the appliation and create a new report, I always get an instance of the original ReportDetailView. How can I get him to use ExtReportDetailView for editing?
Hello,
I think you should override, not extend.
In your case, Report add-on is still referencing the old controller, route and xml descriptor.
It’s calling ReportDetailView and that is using report-detail-view.xml, not the ext one.
If you override, Jmix will know that when Report-addon is calling ReportDetailView it should use yours.
Controller would look like this:
@Route(value = “reports/:id”, layout = DefaultMainViewParent.class) @ViewController(id = “report_Report.detail”) @ViewDescriptor(path = “ext-report-detail-view.xml”)
public class ExtReportDetailView extends ReportDetailView {
Same @Route, same @ViewController, copy-paste xml from report-detail-view.xml to ext-report-detail-view.xml - then change that to get a different UI. (That’s what I do, I do not extend xml descriptors)
If modifying the methods, you need to use @Override.
Make sure your jmix/conf directory is empty, sometimes there can be a problem with hotdeploy: an old version of the files will be used and ignore your changes. Maybe this is happening to you, delete everything inside
accept default package, best manage yourself with desired folder - on the picture is override folder, in the project I just accepted default and that would be bad in bigger project
Override view: type report_Report, select when found
Init view layout with: Copy layout of existing screen - that will basically copy paste the existing xml into a new file
Descriptor name: it will offer you ext-report-detail-view , I used ext1, prefix can be anything
Start making your changes. I have added a new tab with a dummy button as an example.
There is more to overriding with Spring Boot, giving you finer control, using @Primary or registering in @Configuration file, but the given example should work just fine without adding complexity complications.