Questions about cuba 7 after migration

Hi,

  1. In a lookup field, how do you force the picker to open its related entity screen dialog in a modal?
    I don’t see this option when choosing type “picker_lookup”.
    If I set the related entity to forceDialog="true", it will never open in a new tab and that’s not good.
    I’m looking for a way to let picker_lookup to open its screen dialog.

  2. I have a master-details screen and im calling it from a frame.

     <window ...>
         <data>
            ....
         </data>
         <layout>
             <frame height="100%" screen="masterdetails_EmailLog.browse"/>
         </layout>
     </window>
    
    
     @UiController("masterdetails_EmailLog.browse")
     @UiDescriptor("email-log-browse.xml")
     //@LookupComponent("table")
     @LoadDataBeforeShow
     public class EmailLogBrowse extends ScreenFragment {
     }
    

When I click on “create” in the master details grid, the system looks for the edit screen and throws an error. in master details there is no edit screen, it is embedded.
Attached, sample project.

Application -> Email Log Frame -> click on “Create” and you will get the error.

masterdetails.zip (96.7 KB)

Thanks

Hi Avi,

  1. You should create your own action types and use them instead of standard create and edit. See an example here: OpenType.DIALOG in v 7 - #5 от пользователя gorelov - CUBA.Platform

  2. The logic of editing entities is in MasterDetailScreen base class, so when you replaced it with ScreenFragment, you have lost it. A workaround is to copy the logic from the base screen to a base fragment in your project, say MasterDetailFragment, and use it as a base class for your fragment. See an example in the project masterdetails.zip (101.5 KB).

    Although, keep in mind that fragments share the data context with the host screen. It means that if you commit in a fragment, all changed data in the host screen and all its nested fragments will be committed too. This may lead to unexpected behavior in complex screens, so we are not going to provide such base fragments in the framework.

Regards,
Konstantin

@knstvk thank you.

  1. I solved it by using:
   @SuppressWarnings("unchecked")
   @Override
   public void actionPerform(Component component) {
       screenBuilders.lookup((PickerField)component).withOpenMode(OpenMode.DIALOG).build().show();
   }
  1. Is this going to be part of a future update? because of not I will give up on masterdetails, I dont want to maintain this class on my end.

Thanks for your time!

  1. Right, this is a correct solution for lookup picker actions.

  2. As I wrote above, a frame in general should not commit DataContext itself, because it leads to commit of all changed data in the screen and other frames too. So the logic of master-detail screen is not fully compatible with the concept of frames. That’s why we won’t provide such base class in the framework. We think that frames must be more fine-grained and created only on the project level.

1 Like