cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements - Custom Logic When a FacetTable is Loaded or Refreshed

0 Kudos

Hi,

I am trying to attach an event to a Facet after the Table is loaded.

Tried using onAfterHandler in Object Page Extension API. I am not able to get the Control details using below statement.

sap.ui.getCore().byId('awa.dom.ui.docketing::IncomingCorrespondenceObjectPage--fe::table::allContent::LineItem-innerTable')

I am able to reach only till LineItem as below.

sap.ui.getCore().byId('awa.dom.ui.docketing::IncomingCorrespondenceObjectPage--fe::table::allContent::LineItem')

I will not be able to attach my custom event to LineItem. I need a way to attach it to innerTable.

Can you let me know how can I do this. Looking for something similar to below documentation which is applicable only to oData v2.

https://sapui5.hana.ondemand.com/#/topic/382a6c39fd494c12a4ee23c8659909bd.

martinstenzig
Contributor

You should probably change the tag from CAP to Fiori Elements as this is not really a CAP question.

View Entire Topic
daniellelyle
Participant
0 Kudos

The getRowBinding() method gives you a list binding for which there is an attachRefresh() available. In order to get the row binding, the table data needs to be loaded, so the implementation looks something like this:

// Use up to 'LineItem::xyz' for the ID
const table = this.getView().byId('your-table-id');

table.addDelegate({
    onAfterRendering: function () {
        if (table.getRowBinding()) {
            table.getRowBinding().attachRefresh((e) => {
                // logic here
                // you can access e.getParameter('reason') for more information about the event, I think it also runs when the page is loaded
            );
        }
    }
})
0 Kudos

Hi Danielle,

Thanks. Good suggestion. Let me try this and get back.

Hi Danielle,

It worked. I was able to add my logic within Table onAfterRendering.