Lessons learned: don't full update after deleting all documents in a view

Thursday, March 20, 2014 at 5:56 PM UTC

During my close-to-disaster experience yesterday (early morning today to be honest) I encountered a problem. The ingredients are the following (if you want to reproduce it):

  • XPage with a repeat control, data source is a view holding documents of a type X
  • button to call a bean method to remove all the documents of that view (via ExtlibUtil.getCurrentDatabase().getView("foo").getAllEntries().removeAll(false) )
  • Full update set in event that calls the bean method
  • I received a server error (Unable to push data because: Error while executing JavaScript computed expression...)

Reason: the just deleted collection of documents that are used for the repeat control to be refreshed cause this error - crap!

Somewhat strange but not really - I think it is a timing problem. To workaround that issue you can refresh your page via client side Javascript:

<xp:this.onComplete>
XSP.partialRefreshGet("#{id:yourRepeatControlID}");
</xp:this.onComplete>

That works fine without any server errors Lächelnd







Leave a comment right here