cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MDK - Data Pagination (Mobile Development Kit)

umberto_panico
Participant
0 Kudos

How to handle data pagination in SAP MDK ?


Hi All,

We are developing a native SAP MDK Offline app (on Android and Web) but we are struggling with a behavior that we are not able to fully understand.

The app is not able to display the result of a get request inside a collection due to the large amount of data, so it get stuck.

On the web app we are using as a container an Object Table, while on Android we use an Extension Object Collection.

We are using in both cases a String Target (that points to a rule) to request the data and then return it.

Inside this rule we have a Read OData Action and we built the query manually (this is also the main reason that led us to use the string target, as the standard search query handled by the MDK didn’t fit our needs) that includes also $skip and $top parameters (used to avoid the load of the whole set of data).

Now, we are not able to use the data pagination so that we can scroll until the bottom of the list and load and append new records to display. We have indeed a static number of records retrieved with our $skip and $top parameters (ex. $skip=0&$top=100).

We also noticed that, as we used a String Target, we miss the ServerSidePaging option inside the editor (but I expect that this wouldn’t affects the offline mobile app anyway). We have also a DataPaging option but it seems to not work.

Is there a way to handle this behavior?

Thanks!

Umberto

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Data paging is in collection controls is automatically handled within MDK when using an OData target. For Offline use cases MDK you can define the page size and MDK will automatically add the top/skip parameters to the call to offline odata and as you scroll fetch the additional data.

In an online use case the same also applies with top/skip by default but you also have the option (depending in your odata service) to enable server side paging where if the odata server doesn't support top/skip but already does paging from the server side and provides a next link MDK can use that as the user scrolls to make an additional call to the odata service to get and display more data.

If you are using a string target MDK assumes all data is provided up front and there is no data paging.

From your description you are doing an OData read already so my recommendation would be to use an OData target. You mention some challenges with that so perhaps you can share more about those challenges as to why this isn't an option in your case.

umberto_panico
Participant
0 Kudos

Hi Bill,

We had to use the String Target because we enabled the SearchEnabled flag in our lists and its behaviors are automatically handled by the MDK.

This was not good for us because we noticed that the search functionality is not working when:

  • The properties in a cell of a list are binded through the use of a js rule
  • The cells are custom extensions

Due to this, we decided to switch to the String Target, that allowed us to manage the query to send to the BE every time a new character is inserted inside the searchbar.

Best Regards.
Umberto

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you want to search on fields that are not directly bound or you are using a custom extension (I assume via Extension Object Collection) you can define a rule for your Query Options. This rule is triggered when searching and you can use the Data Query Builder to define your own search criteria structure. This is needed for properties where the value comes from a rule.

Customize Query Options with Data Query Builder

umberto_panico
Participant
0 Kudos

Bill, thank you very much! Your proposal has given us benefits, in detail now work well in web side but does not work on mobile.

On Android device we tried pagination with standard elements and it works, instead the same List with custom elements doesn't work.

Do you have any other suggestions for us? Please let me know if you need more details.

Thanks again.
Umberto

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

What version of MDK are you running? Can you share more details about your list with custom elements? What type of control are you using? Maybe even share the page metadata and the query options rule. Feel free to share over PM if preferred.

umberto_panico
Participant
0 Kudos

Sure!

  • MDK version: 6.2.5
  • Standard element: objecttable
  • Custom Element: extension object collection

In attachment (page files renamed to txt files):


Best Regards,
Umberto

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

For the Extension Object collection you can still use the Query Option rule to handle the search terms using the Data Query Builder.

In terms of the paging on the Extension Object Collection, we are aware of an issue where the list will not automatically page data as expected. I already opened an internal ticket so the team can work on a fix in an upcoming patch.

umberto_panico
Participant
0 Kudos

Thanks Bill.

I hope that the problem will be solved soon, unfortunately in our case this problem is blocking for the go live planned next week.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

The extension collection paging on Android has been fixed in MDK 6.2.6 and is available on the marketplace for download.