Hi everyone, i have a class A which is a base class with that (@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)), then i have other classe B and C which inherits from A (they do not add any field) is there a way to handle efficiently this situation without duplication ListView and DetailView? For the ListView i came up with a solution where ii change the DataLoader using setQuery() based on some parameters. But i have some problems handling the detailView, when i am in the listview of B and click on any item it throws B.detail not found . Any help? Thanks
Hi,
I’d recommend creating a base class for all entity views rather than using the same view and trying to adjust it.
In your case, you need to override create and edit actions and explicitly open dedicated view, e.g.:
@Subscribe("asDataGrid.editAction")
public void onAsDataGridEditAction(final ActionPerformedEvent event) {
viewNavigators.detailView(asDataGrid)
.withViewClass(ADetailView.class)
.navigate();
}
Regards,
Gleb
I’d recommend creating a base class for all entity views rather than using the same view and trying to adjust it.
What do you mean by that? Because my goal is to create only two views: a list and a detail.
It’s better for each entity has its own list and detail views because default actions like create, edit, lookup opens a corresponding view according to View Inference Conventions, i.e. in a base case, a view with a specific id, e.g.: SomeEntity.detail
.
If you have a single set of lists and detail views for several entities, you will miss this convention and will have to open the corresponding detail/lookup views programmatically. Therefore, I propose creating base classes for lists and details that encapsulate common logic rather than using the same views and trying to customize them.