cancel
Showing results for 
Search instead for 
Did you mean: 

[SAPUI5] Refresh table data using query Parameters and bind JSON data

0 Kudos

Hi Experts,

I am using REST APIs to fetch data from backend, I want to fetch data based on query parameters.

My REST service does not return any data if there is no query parameter.

e.g My service URL is https://Host/rest/countries?region=asia

It will give list of countries if I give region=asia but if I don't add region then I will not get any country. I have defined service URL in menifest.json as below

"dataSources": { "mainService":{ "uri": "https://Host/rest/countries?region=", "type": "JSON" } },

Now I want to pass region value as parameter from input field and populate table.

If I give complete URL in manifest.json then my table is loaded on initial load

"dataSources": { "mainService":{ "uri": "https://Host/rest/countries?region=asia", "type": "JSON" } },

For me it's fine if initial load is blank but I want to load table after I pass parameter from input field.

How can be this achieved, any pointer will be helpful.

Regards,

Rohit

Accepted Solutions (0)

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

you will need to create a json model in your app and load the data async.

here is an example of how the json model makes an ajax call

https://sapui5.hana.ondemand.com/#/api/sap.ui.model.json.JSONModel -- look into loadData function