Skip to Content

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

Nov 08, 2017 at 06:36 PM


avatar image

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.



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sergio Guerrero Nov 08, 2017 at 10:01 PM

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 -- look into loadData function

10 |10000 characters needed characters left characters exceeded