Composition Entity Table Refresh

Hi,

I am attempting to replicate the generic editor generated for an entity with a attribute that is a composition relationship but with some customization. Similar to the sales sample where the order editor has a groupBox/table for OrderLines.

To put it into the same terms as the Sales sample, I recreated the layout for the Order editor but I added some custom buttons that open some custom editor screens for the OrderLine. The buttons are functioning, the custom editors appear, but when I hit ‘OK’ on the OrderLine editor and the Order editor come back up, the groupBox/table is not updated with the OrderLine I just created. I tried refreshing the Datasource for the table, but that didn’t seem to have any effect. However, if I hit ‘OK’ on the Order editor but then open the same instance of Order for editing, the groupBox/table shows the new OrderLine. What could I be missing on this?

Specifically, it is a dialog box that is being opened for the OrderLine editor. Would this make a difference? If so, then how do I refresh the underlying page with the dialog closes?

Hi,

Probably you should replicate behavior of CreateAction.internalOpenEditor() method in the part where it invokes datasource.includeItem(editedItem) if parentDs is not null - this is the case of composition.

Also, consider using CreateAction itself and customizing it with windowId for opening a specific editor and/or BeforeActionPerformedHandler, AfterCommitHandler, etc.

Let us know if it doesn’t work for you.

The CreateAction/ EditAction option worked well. Another question I have about the same screen. Again, in terms of the sales sample app.
My custom order editor doesn’t use just a basic field group. I added some buttons (‘Add Customer’, ‘Add Date’, etc.). In addition to this, I have some labels at the top of my page that let you know if the customer/date/etc. column of the entity currently being edited has been filled or not. So before I add a customer, the label says “no customer specified”. I click on my ‘Add customer’ which opens a dialog. I enter my customer’s name and press okay. When the dialog disappears, I want the label to say “Customer Specified”.
I so far have the label, my button invokes

onAddCustomClick()

which calls

openEditor("orderCustomerEditScreen", orderDs.getItem(), OpenType.DIALOG) 

, and I know that the value is being recorded somewhere because when I got back to the Order editor screen (by pressing ‘OK’), I see the customer. But I can’t figure out how to update the label on the fly within the Order editor.
I don’t know how to attach an

EditAction

to my buttons to which I can append an

AfterWindowClosedHandler 

Thought?

You can add an ItemPropertyChangeListener to your datasource and get notified about all changes in attribute values.