Unable to display the updated list after pagination

Unable to display the updated list after pagination

  


Hello,So the issue is as below.I have a list record to display some list of records that I get from a rest call. I have applied pagination on those records.Its working perfect.

Now, I have an update action on each record in the list which fetches the data again from the rest call. I am updating this on the list record widget, this is again working great on the first page of pagination. But from second page onward whenever i update the record, it displays blank list on UI (I am getting proper data from rest). I also checked the  List_Navigation_GetStartIndex on every step, its coming properly.
Can someone please help me on whats missing in here?
I have attached the list attributes and part of my logic.

Any help would be appreciated.

Thanks,

Anagha


Hi Anagha,

What would be interesting to see, is 1) the Properties of the Table Records, especially the Source Record List, and 2) the contents of the Assign shown above, after you call the REST service the second time.

Kilian Hekhuis wrote:

Hi Anagha,

What would be interesting to see, is 1) the Properties of the Table Records, especially the Source Record List, and 2) the contents of the Assign shown above, after you call the REST service the second time.


Hi Kilian,

1. I have already added the screenshot for table record properties. the source record list i.e Timecardrecordlist is the list type variable of the response structure. 

2. Below is the screenshot of the assign. firstly i have assigned the Rest response to the source record list (Timecardrecordlist) of the list record widget. and then i tried assigning the widget list with source record list again since it was somehow not updating, and lastly i am refreshing the widget container.

These assigns are some modifications i tried today, even now the data is not updating.


Thanks,
Anagha


Hi Anagha,

EDIT: Ignore this.

Important: Current is just a copy. Changing it will not change the list.

If you're updating a single line, the easiest way is:

1. Set the new values directly into the TimecardsList.List [ TimecardsList.List.CurrentRowNumber ]...

2. Copy this into the correct index of the local list (because of pagination?)

3. Ajax refresh just this line in the TimecardsList.

This way, just that line will be updated, but as this does not fetch the data again from the local list, you need to update the table line directly.

Cheers

Eduardo Jauch wrote:

Hi Anagha,

Important: Current is just a copy. Changing it will not change the list.

If you're updating a single line, the easiest way is:

1. Set the new values directly into the TimecardsList.List [ TimecardsList.List.CurrentRowNumber ]...

2. Copy this into the correct index of the local list (because of pagination?)

3. Ajax refresh just this line in the TimecardsList.

This way, just that line will be updated, but as this does not fetch the data again from the local list, you need to update the table line directly.

Cheers

Hey Eduardo,

I don't want to update just a single record or single field, their can multiple fields too. Also there can be multiple records to update since i have a checkbox on each record to validate. 

Would it be possible for you to share a simple example on this?
the flow is like
1. I have some data displayed using list record which is fetched from rest.
2. I have validate button on each record as well a checkbox on each record to select multiple record an validate them all with a diff button.
3. When I click on Validate, the service is hit again and updated data should to be shown on UI.
4. This includes pagination also.

I am facing issue with step 3 and 4.

I know I must be missing something very silly, sorry for all the trouble.

Thanks,

Anagha

Hello Anagha

If you are updating many records at a time, just follow the advice of the Current.

DON'T use the current to update a list, because changing the current will NOT update the list.

What's happening is that you're updating the Current variable of the list, so, the actual item is not being updated.

You need to update directly the [ index ] of the list itself.

EDIT. Actually, I am just plain wrong. (Thanks for pointing out this Kilian). Just ignore what I said before. If you update the Current, it will update the respective item. So the problem must lie elsewhere.

Cheers.

Solution

Hello Anagha,

While I'm not sure about the problem solution, as well as I'm not seeing your entire code, I would like to point out a few things.

Once you give the TimecardrecordList as the source of the list, every time you render the Record List in the screen, it will iterate TimecardrecordList to fill its own internal list. This will make the TimecardrecordList.Current to point to the first record of the NEXT page (relative to the page it is showing).

So, if you have 10 records (1 to 10), and your table/list records in screen has the Line Count set to 5, when the page is rendered the first time, the TimecardrecordList.Current will be pointing to register number 6. If you click in the first record of the table executing an action that will change the Current of TimecardrecordList, you will be changing the register 6, not 1. 

Note that if you refresh the entire Table/Record list, it will fetch the source again. So, there is no need to assign TimecardrecordList to the TimecardsList list record again (I had problems doing it).

Could you check if, removing the assign to the TimecardsList.List the changes are being made in the next page?

Cheers.

Solution

Eduardo Jauch wrote:

Hello Anagha,

While I'm not sure about the problem solution, as well as I'm not seeing your entire code, I would like to point out a few things.

Once you give the TimecardrecordList as the source of the list, every time you render the Record List in the screen, it will iterate TimecardrecordList to fill its own internal list. This will make the TimecardrecordList.Current to point to the first record of the NEXT page (relative to the page it is showing).

So, if you have 10 records (1 to 10), and your table/list records in screen has the Line Count set to 5, when the page is rendered the first time, the TimecardrecordList.Current will be pointing to register number 6. If you click in the first record of the table executing an action that will change the Current of TimecardrecordList, you will be changing the register 6, not 1. 

Note that if you refresh the entire Table/Record list, it will fetch the source again. So, there is no need to assign TimecardrecordList to the TimecardsList list record again (I had problems doing it).

Could you check if, removing the assign to the TimecardsList.List the changes are being made in the next page?

Cheers.

Thank you evryone.

The issue is resolved now. I removed the current assign and looped the complete list to match the record with record id. And then updated the source list too. 

Anagha :-)


U have to implement on notify event and refresh the data and pagination widget.