Part of this problem was that when adding a comment it get connected to the wrong parent document. This problem was caused by a Dojo Content pane added to the xpage having set partial refresh to true. If I removed that setting from the dojo content pane the comments are now connected correct again. The problem of editing the wrong post is still a problem if repeatControls is set to false. setting repeatControls to true will resolve the issues. but then the repeat require full update to see the new documents which is not a satisfying solution
There is something not right with how updated view data is handed in XPages
The following video show I am in a web page that does not have the latest documents displayed. If I try to edit a document in the view I edit the wrong document
I guess the reason for this behaviour is that the repeat , viewpane or data table is simply looking at the index. so if you click to edit index number 0 on your webpage, and another document has been added to the index 0 since you reloaded, index number 0 is no longer the document you intended. so you get to edit the last added document at index 0.
I have not found a solution to this problem and it is currently a big problem in my application as it affects also responses and other actions connected to the document I am acting on.
In the video above the view panel is refreshed when editing but even if only the current edited entry is updated with partial refresh I experience problems that a response is connected to the wrorng parent document. so the solution to this problem is not as simple as specifying which element to partial refresh
here is another example,
The problem is really too complex to explain and I see different results if I try it in my demo application and in my live application but the problems are similar
I have tried so many ways to get this solved but still not found any good solution
- I tried to change the scope on the document data source and view data source
- I tried to switch the dataCache property on the view data source
- I tried to get hold of the "correct" unid in each entry and use that when editing and commenting but the currect unid is not accesible it is updated with the new unid
- I tried to use a computedField inside the repeat to load only onPageLoad but that option does not seem to work inside a repeat
- I have tried to turn off automatic refresh on the view but that will not work as there is no way to tell when it is time to update the view as many users are accessing the application at the same time.
- There is a settings on a repeat to set repeatControls to true but that gives me other problems as the repeat is not updated on partial refresh
Also look at my Stack Overflow problem for more info
Here is the demo application in the second video above