When using lazy dataTable another component does not get updated / 2nd component data is one request behind

自古美人都是妖i 提交于 2019-12-05 06:31:59
jimmybondy

After searching the PF forum I found the root cause:

The dataTable Lazy load() method is invoked during render response phase

To know about the phases, read this tutorial on JSF lifecycle from BalusC

Solutions for displaying messages (e.g: p:messages or p:growl):

  1. Update message component with PrimeFaces RequestContext

    RequestContext.getCurrentInstance().update(":growlOrMsgID");
    

    This will not work because at that time it's too late to add additional components to update.

  2. use dataTable attribute errorMessage

    No attribute found with this name for dataTable

  3. Put the p:messages or p:growl below the p:dataTable

    Worked for me

  4. Use PF execute method of RequestContext

    The RequestContext#execute() executes a javascript after current ajax request is completed.

    Worked for me


See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!