Ajax refresh and list items order


We have a list with webblocks inside it and use ajax refresh in them to refresh part of it and also trigger event that changes the order in the list. If event is called before refreshing part of the webblock then this part is changed in the wrong block - the one that takes its place after list order check. So imagine a todo list thatis showing completed items first. each row has a checkbox when checked it shows tick image and list is refreshed to apply new order. So inside task row we have oncheck event where we have both ajax refresh for switching from checkbox to custom image and event that is catched on parent block that resets the list order. So if event is called last all is fine, but if we call event and then call ajax refresh - list is reordered and then checkbox on the row that has took place of completed task is refreshed. So we end up having wrong item checked.

do you really need to use weblocks within list items and have to manage that weblock logic? if you can keep it simple, assuming that the preparation query is ordered by 'done' field and that the checklist value is binded to the 'done' field:

Hi João. 

Example was a simplified version of what we actually have. 

We solved it by not having Ajax refresh as when we refresh a list rows are also refreshed. 

But initially we noticed this behaviour when we added this change of order and were not intend to update existing logic so we can enable/disable this functionality in one place. 

Anyway my question is if this is a bug (that Ajax refresh uses position of element in the list instead of other reference) or it is expected behaviour.

Hi Nick, if i understood your question that is the expected behavior.

 You are defining your changes before the Ajax refresh so they are defined to a certain position on the list. When you use Ajax, the position of your registration changes but your definitions are applied to the older position. I had a similar problem and my solution was to find the new position of my record after the order, filtering the list by certain characteristics.

Hi Mariana,  it seems like Ajax action is tied by element id and automatic generated element ids depends on position on the list...