Extend addon notification views not working any more in 2.3 for me

v 2.3

After upgrading to v2.3, I got an error message when I tried to open in-app notifications
by clicking on the bell icon.

I deleted the extended view I had for received-in-app-notifications-dialog.xml

After that I created the extended view new using the wizard.
It works fine without an error.
But, what ever I try now, I cannot change the view any more…
I wanted to add the body property to the grid.
Here is the xml code I use:
I cannot see what I do wrong…
KR
Roland

> <data readOnly="false">
>         <collection id="userInAppNotificationsDc"
>                     class="io.jmix.notifications.entity.InAppNotification">
>             <fetchPlan extends="_instance_name">
>                 <property name="type"/>
>                 <property name="contentType"/>
>                 <property name="body"/>
>                 <property name="readStatus"/>
>                 <property name="createdDate"/>
>                 <property name="createdBy"/>
>             </fetchPlan>
>             <loader id="userInAppNotificationsDl">
>                 <query>
>                     <![CDATA[select e from ntf_InAppNotification e where e.recipient = :recipient
>                                 order by e.createdDate DESC]]>
>                 </query>
>             </loader>
>         </collection>
>     </data>
>     <layout>
>         <dataGrid id="userInAppNotificationsDataGrid">
>             <columns>
>                 <column property="body"/>
>             </columns>
>         </dataGrid>
>     </layout>

end

I also tried it with application settings…
It is also not working… which means, actually I cannot extend existing views…

Here the code for the application settings with 2 test overwrites:
Do not see it in the GUI…

Roland

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<view xmlns="http://jmix.io/schema/flowui/view"
      title="msg://io.jmix.appsettingsflowui.view.appsettings/appSettingsEntityView.title"
      extends="io/jmix/appsettingsflowui/view/appsettings/app-settings-entity-view.xml"
      messagesGroup="io.jmix.appsettingsflowui.view.appsettings">
    <layout>
        <hbox id="buttonsPanel" visible="false">
            <button id="saveBtn" text="test text"/>
            <nativeLabel id="testlabel" text="test text 2"/>
        </hbox>
        <nativeButton id="btn" text="test" classNames="primary"/>
    </layout>
</view>

Hi,

If you can’t change a view or a controller, look under .jmix\conf and delete all. Until they fix it. (if that is the problem)

Kind regards,
Mladen

Hi,

I cannot find any .jmix/conf directory.
As another test I zipped the project and opened it in another new project folder.
Also not working…
When I change the controller or descriptor,
hot deployment works.
But it looks like the extended views are not used.

KR
Roland

You can switch to Project tab, its second to the project root

image

But this can also be unrelated because I had trouble overriding and extending in the past.
Does it work inside a new, fresh project?

Kind regards,
Mladen

Hi,

in my main project, the conf dir does not exist.
In a new project it does and I can see the change .xml file for the ext-app-settings-entity-view I created.
But the changes are not reflected in the GUI.

Which means,
extending the view does not work like expected.
And like I wrote before, it worked in an older version (can not remember which one…)

KR
Roland

here the changed .xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<view xmlns="http://jmix.io/schema/flowui/view"
      title="msg://io.jmix.appsettingsflowui.view.appsettings/appSettingsEntityView.title"
      extends="io/jmix/appsettingsflowui/view/appsettings/app-settings-entity-view.xml"
      messagesGroup="io.jmix.appsettingsflowui.view.appsettings">
    <layout>
        <nativeLabel id="testtest" text="testtesttest"/>
        <hbox id="buttonsPanel" visible="true">
            <button id="saveBtn" text="test text"/>
            <nativeLabel id="testlabel" text="test text 2"/>
        </hbox>
        <nativeButton id="btn" text="test" classNames="primary"/>
    </layout>
</view>

Hi, @r.walde,

I have tried to a create a custom view for received-in-app-notifications-dialog.xml using the instruction from docs and it works. Overridden view is shown in the application.

In the case of Override an existing view option, Jmix Studio creates:

  • View descriptor that extends received-in-app-notifications-dialog.xml descriptor
  • View controller class that is annotated @ViewController("ntf_ReceivedInAppNotificationsDialog") and extending view from the add-on:
    @ViewController("ntf_ReceivedInAppNotificationsDialog")
    @ViewDescriptor("ext-received-in-app-notifications-dialog.xml")
    public class ExtReceivedInAppNotificationsDialog extends ReceivedInAppNotificationsDialog {
    }
    

Do you have the same view controller class as described above?

Regards,
Maria.

Hi Maria,

attached my test project where I included also the notification addon.
I created the extended view using the wizard.
One difference I see is the view controller naming and view descriptor naming…
In my app it has leading ext_

attached the project…
I wanted to show the body column in the notification list …

but in the GUI it looks like:
image

testextendview.zip (110.7 KB)

@r.walde To use custom extended view instead of view provided by add-on, it is required to set the value in the @ViewController as in the base screen. In your sample project, the fix will be the following:

@Route(value = "test", layout = MainView.class)
@ViewController("ntf_ReceivedInAppNotificationsDialog") //remove the "ext" prefix
@ViewDescriptor("ext-received-in-app-notifications-dialog.xml")
public class ExtReceivedInAppNotificationsDialog extends ReceivedInAppNotificationsDialog {
}

Regards,
Maria.

1 Like

mmhhh… sorry, I overread that part of the docu:
Note that the @ViewController annotation has the same value as in the base screen. This is important because we actually need to override the base screen, meaning that everywhere in the system the extended screen will be used instead of the base one, as is done for replaced entities.

You can override public and protected methods of the base controller to extend the screen logic if needed.

And,
I thought that the wizard will do it like needed and I didn’t challenged that :frowning:

thx a lot both for your help!

@r.walde What steps did you do in Studio to get this result? Did you use Extend an existing view or Override an existing view template in the wizard?

Regards,
Maria.

Hi @m.orlova,

I did Extend because when doing the Override I get this error when opening the in-app notification:

ClassCastException: class com.schneebaer.view.receivedinappnotificationsdialog.ExtReceivedInAppNotificationsDialog cannot be cast to class io.jmix.notificationsflowui.view.receivedinappnotifications.ReceivedInAppNotificationsDialog (com.schneebaer.view.receivedinappnotificationsdialog.ExtReceivedInAppNotificationsDialog and io.jmix.notificationsflowui.view.receivedinappnotifications.ReceivedInAppNotificationsDialog are in unnamed module of loader ‘app’)

When using Extend and take out the leading ext_ it works fine.

`