简体   繁体   English

Java / PrimeFaces同步Ajax更新

[英]Java/PrimeFaces synchronize Ajax Update

I am trying to synchronize events on the GUI from my backing bean, in order to measure the actual processing time of a particular ajax update. 我正在尝试从我的支持bean同步GUI上的事件,以便测量特定ajax更新的实际处理时间。 As ajax is, to my knowledge, being processed asynchronously, I fail to gather the diagnostics data I am looking for. 据我所知,ajax是异步处理的,因此我无法收集要查找的诊断数据。 Trying my current idea, what I would need to do is execute the second script after the ajax update has been processed. 尝试我当前的想法,我需要做的是在处理完Ajax更新之后执行第二个脚本。

{...
  PrimeFaces pf = PrimeFaces.current();
  pf.executeScript("functionStart('columnMapping')");
  pf.ajax().update("contentForm:tv_main");
  pf.executeScript("functionEnd('columnMapping')");
...}

How can I accomplish this? 我该怎么做?

Cheers, Giagl 欢呼声,贾格

You need to put the call to "functionEnd" into the callback function of ajax. 您需要将对“ functionEnd”的调用放入ajax的回调函数中。 The most likely function you want is "onsuccess". 您最想要的功能是“成功”。 Try 尝试

pf.ajax().update("contentForm:tv_main").onsuccess(pf.executeScript("functionEnd('columnMapping')"));

However from your sample code it's hard to know what exactly you are trying to do exactly, maybe you can share a little more information on what you are trying to accomplish. 但是,从示例代码中很难知道您到底想做什么,也许您可​​以分享一些有关想要完成的事情的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM