cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Fiori Elements (List Report) - Update Table after custom actions

Sai_Nithesh_G
Contributor
0 Likes
7,444

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Michael030727
Discoverer
0 Likes

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 🙂

 

judy_shi45
Associate
Associate
0 Likes

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();

})
Kishannaicker
Participant
0 Likes

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();
}
rounak_roy
Product and Topic Expert
Product and Topic Expert
0 Likes

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

Sai_Nithesh_G
Contributor
0 Likes

Thanks Rounak, we have tried the approach which you have suggested, it is working only in updating the table, but it is not clearing the table selections.

Regards,

Sai Nithesh

MioYasutake
SAP Champion
SAP Champion
0 Likes

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

Sai_Nithesh_G
Contributor
0 Likes

Thanks for your response Mio.

We tried following the shared link. but we haven't observed any change in the behavior. We tried by using GO id and fired press event, not it started working.

Regards,

Sai Nithesh

Mahesh_P
Discoverer
0 Likes

Hi @Sai_Nithesh_G were you able to figure out the issue, I also facing the same issue.