on 2021 Jul 27 12:29 PM
Hi Experts,
I am working SAP Fiori Elements (List Report) using UI Annotations. I have requirement where we need to update the List Report Table after performing custom actions. Is there any extension API/ method available to achieve the requirement.
SAP UI5 version: 1.71.29
Please do let me know, if you need any more details.
Regards,
Sai Nithesh Gajula
Request clarification before answering.
Hey SAP-Fellows,
1. search table ID in registry and log it:
console.log("Serach tables in registry...");
sap.ui.core.Element.registry.forEach(control => {
try {
const id = control.getId();
const type = control.getMetadata().getName();
if (type.includes("Table")) {
console.log(`📌 Table found – ID: ${id}, Typ: ${type}`);
}
} catch (e) {
//Element no control
}
});
2. Refresh table-items by ID:
const tableIDs =
[
"ordersoverview::OrdersList--fe::table::Orders::LineItem-innerTable",
"ordersoverview::OrdersObjectPage--fe::table::tripOrders::LineItem::tripsoforder-innerTable"
];
tableIDs.forEach(id => {
const table = sap.ui.getCore().byId(id);
table?.getBinding("items")?.refresh();
});
Kind regards 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi SaiNitesh,
Refresh odataModel could solve this problem.
Make sure to refresh odataModel after your custom change is done.
Here's my code:
let taskContext = taskModel.bindList("/Tasks").create({
name: taskName,
description: taskDescription,
status: 'To Do'
});
taskContext.created().then(()=>{
oDialog.close();
//refresh odatav4 model
taskModel.refresh();
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi SaiNitesh,
Could you try this if it can help :
this.oDataModel = this.getOwnerComponent().getModel();
this.oDataModel.refresh();
this.extensionAPI.rebindTable();
if (this.oDataModel.getPendingChanges()) {
this.oDataModel.resetChanges();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello SaiNitesh,
In your custom action function, you can simply get the table control, by doing a get id and then get the model of the table and directly refresh it.
Example: Let's say table id is "LRtable" then,
sap.ui.getCore().byId("LRtable").getModel().refresh();
Regards,
Rounak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sainithesh.gajula,
The following document may be relevant to your question.
Please see the section "Example: Side effect after executing an action".
https://ui5.sap.com/#/topic/61cf21d50ed34cbf888713496c618904
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sai_Nithesh_G were you able to figure out the issue, I also facing the same issue.
| 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.