Refresh browse inner edit window

Hi

I have two entites Articles and PriceList with composition relation one to many. I craete window like bellow

obraz

I create action for button Test

public void onCustomAction() {
	Action priceAction = new ItemTrackingAction(priceitemTable, "priceAction").withCaption("Test")
			.withHandler(event -> {
				Set<Pricelist> selected = priceitemTable.getSelected();
				if (selected.isEmpty()) {
					showNotification(getMessage("rental_select"), NotificationType.HUMANIZED);
					return;
				}

				Pricelist price = priceitemTable.getSingleSelected();
				AppBeans.get(RentalPriceService.class).setPriceFlag(price.getArticles().getId(), price.getId());
				priceitemDs.refresh();
			});
	priceitemTable.addAction(priceAction);
}

I do data manipulation in service RentalPriceService How can I refresh priceItem browse, then method priceitemDs.refresh() doesn’t work.

Hi!

The entity instance updated by the service and the entity instance loaded with the parent entity are two different objects. You are using the composition relation. Updating the datasource will have no effect. Either you have to refresh the parent datasource or your service should return an instance of the changed entity and possibly without saving to the database. Next, you need to add the modified instance entity of the datasource instead of the “old” one. The datasource will go into the modified state. Together with this, the screen displays the changes. It is necessary to understand that the real preservation of the instance will occur while preserving the parental essence, since this is the meaning of the composition relation.

If I understood well I have to return modify entites to onCustomAction method from service. Next I have to update this entity instance in datasource. May you give me same example.

I add priceitemDs.modifyItem(price); in onCustomAction method and browse refresh automatically. Is it possibly ? I don’t invoke browse refresh method after modify entity.