Setting editor values

Hi,

My scenario is this. I have an entity with a lot of attributes to display. So, while I have a master editor page with all attributes displayed / editable, I also want to create “shortcut” editor pages on the master page that updates different subsets of attributes at a time. What I’ve done so far is:

  1. Created views on the entity that have the subset attributes and an editor page to match
  2. Launch the subset editor from within the main editor by code which also updates some of the attributes e.g.

// within the main editor controller .. 
// load the customer entity from the injected customer datasource
Customer customer = (Customer)customerDs.getItem();
customer.setFirstName(customer.getFirstName()+"1"); 
// TODO how to update data on the new screen? setting it here only updates the main screen. 
CustomerNewUpdateEdit editor = (CustomerNewUpdateEdit)openEditor("sample$CustomerNewUpdate.edit", customer, OpenType.THIS_TAB);

My questions are:

a) How do I set an updated value on the new editor I’m opening up? As per the code comment, it only updates the main editor, which I only see after I’ve closed the subset editor.

b) I’ve also tried looking for a way to pass a parameter into the editor, but couldn’t seem to find a way.

c) Is there a better way for me to “jump” from one editor / view to another? Not sure if it’s going to cause any problems by opening another editor on the same entity.

Thanks,
Eddy

Hi Eddy,

You cannot use openEditor() method and AbstractEditor subclasses in this use case, because when you open an editor, the passed instance is reloaded from the database and when you commit the editor the instance is saved to the database (except when you use compositions).

I think the proper way to implement such “partial” editors opened from a master one is to use AbstractWindow subclasses, to open them with openWindow() and to pass the datasource of the master editor as a parameter.

Let me know if you have difficulties with this.