on 2024 Jun 28 5:13 AM
Hi all, we have a requirement for 2 detail pages for each entity. When we click on a row item in the list page, we navigate to detail page 1. On detail page 1, we have another button to view detail page 2. Hence the routing hierarchy is list page -> detail page 1 -> detail page 2. For both detail pages, we bind the entity to the view based on the tutorials like such
private onRouteMatched(event) {
this.entityId = event.getParameter('arguments').objectId;
const entityPath = `/${RESULT_ENTITY_NAME}(${this.entityId})`;
this.getView().bindElement({
path: entityPath,
events: {
dataReceived: async (event) => {
const params = event.getParameters();
if (params.error && 'status' in params.error && params.error.status === 404) {
await this.getRouter().getTargets().display('notFound');
}
},
},
});
}As you can see, we will navigate to a not found page if a 404 error is thrown. The code above is the same for both detail pages.
We have a delete button only on detail page 1 for deleting this entity. After delete we will navigate to the list page. The problem comes when the user is at detail page 1, enters detail page 2, presses back to go back to detail page 1, then presses delete. For some reason, this triggers a 404 error in the element binding in detail page 2 and we navigate to the not found page, even though we have navigated to the list page already. If we were to press delete the first time we are on detail page 1 (i.e. we never navigated to detail page 2), the delete works perfectly fine (we navigate to the list page properly and stay on it).
I think the issue is with the binding we are doing in both detail pages, but I'm not sure how to work around it.
Request clarification before answering.
Found the fix. The problem was after delete, I called `model.refresh()` (in the detail page). I removed the line and added `table.getBinding('items').refresh()` inside my Main controller's `router.onPatternMatched` callback instead
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.