Navigation\Pagination doe not refresh after query refresh

Hi,

For: Reactive App

i use a "fetch data from other source" to fill a table. Technically its end up in a server side action and SQL Query to ask for one page of data (15 Records).

I added and initialized the pagination widget , looks good at start 



and the action to refresh the query 


so this works, the table updates, but the pagination stubbornly never changes. If I uses aggregate (as in the demos) it works fine.

So the only difference i refresh a other data source query. Buf or Feature ? Any workaround? 

Stefan Lang 

The Assign Varible Before Refresh Data

Or Using One Inputparametr And  Assing the like Image 

I will Share Image For You 

Stefan Lang wrote:

Hi,

For: Reactive App

i use a "fetch data from other source" to fill a table. Technically its end up in a server side action and SQL Query to ask for one page of data (15 Records).

I added and initialized the pagination widget , looks good at start 



and the action to refresh the query 


so this works, the table updates, but the pagination stubbornly never changes. If I uses aggregate (as in the demos) it works fine.

So the only difference i refresh a other data source query. Buf or Feature ? Any workaround? 

 You shall  Assign StartIndex before Data fetch in the flow.

 

Hi, unfortunately that doe not change the behavior of the pagination widget at all 

Hi Stefan,

You need to use offset and Fatch next  in advance sql like below query-

SELECT {CustomerName}.*
  FROM {CustomerName}
 ORDER BY {CustomerName}.[Id] DESC
OFFSET @StartIndex ROWS
 FETCH NEXT @MaxRecords ROWS ONLY

Attached one sample oml.

hope this will help you.


Regards

Rahul Sahu

Hi Stefan,

I'm assuming the logic you are showing is the OnPagination Handler ??

So the assign statement sets some local start index variable to the NewStartIndex input value ?

If the only thing not updating correctly is your 'current page' indicated in the navigation, can you take a look at the properties of your navigation widget.  The StartIndex property should be a variable, reflecting the item currently being the first retrieved.  

So typically, you would have 2 local variables in your screen, as you are executing an sql, let's call them Offset and Records.

So in your dataAction, your sql will have 2 input parameters, passing these 2 in , and you can write your order by using these 2 parameters

ORDER BY <some order by clause> OFFSET @Offset ROWS FETCH NEXT @Records ROWS ONLY

so, in order for your pagination to update it's ui correctly, make sure that it's property StartIndex is set to this local variable Offset, and its MaxRecords to this local variable Records.


Arguably, you could forego on the Records variable, and hardcode 15 in both the sql and the pagination property, but that's just plain ugly.  Now, all you have to do is set the default value of this local variable to 15, and both the pagination widget and the sql are in synch.  Much easier to change your mind later on how much you want in one page.

And yes, if you work with these local variables, it does matter if you assign CLOCStartIndex before or after your Refresh, as Sanjay said.

Hope this clarifies,

Dorine