cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Reload/Refresh the table data using sap.ui.table.Table

Former Member
0 Kudos

Hello All,

I have created an application where i am displaying the HANA table data in tabular format using sap.ui.model.odata.ODataModel and sap.ui.table.Table

What needs to be done or triggered to reload the table display from HTML page, as soon as there is a change in the table data.

I am updating the table data using another call (using XSJS) from the same HTML screen.

Thanks

Ramesh

Accepted Solutions (0)

Answers (2)

Answers (2)

ashwin_narayan
Participant
0 Kudos

Hi Ramesh,

I'm going through kinda same scenario as yours. I am curious to know how are you updating the Hana table, is that a odata update call again, or do we have a way to do it?

Suggestions from anybody is welcome.

Thanks,

Ashwin

Former Member
0 Kudos

OData.request(requestObj, function() {

  sap.ui.getCore().getModel('products').refresh();

 

  });

WouterLemaire
Active Contributor
0 Kudos

You could use setTimeout in javascript to check if the data is changed every 5 seconds:

Window setTimeout() Method

Kind regards,

Wouter

Former Member
0 Kudos

Thanks for the reply

Now my question here is how can I make a call to refresh the table data only, with out reloading the whole page.

As I am not using any function for displaying the table data.. I am just making call to the above 2 methods in the VIEW page

WouterLemaire
Active Contributor
0 Kudos

In the timeout, do a call to a function. In that function you can update your model. If you are using bindings in your table, then the table will change when you update your model.

Model <-> table

You can use the following to load your new data:


oModel.read('/Products(1)',null,null,true, function(oData, oResponse){

  alert("Read successful: " + JSON.stringify(oData));

   },function(){

  alert("Read failed");});


Documentation/AdvancedTopics/DataBinding/ODataWrite – SAPUI5 Wiki (TIP CORE User Interface)


Kind regards,

Wouter

Former Member
0 Kudos

oModel.refresh();

This will check all bindings for updated data and update the controls if data has been changed.