2 Replies Latest reply on Apr 15, 2015 7:54 AM by nitin singhal

    How to avoid nonexistant id calls?

    Akaine Harga Novice

      Hi everyone


      RF is good and RF is nice but there always was a problem: what happens when these "incompetent and impatient" users start clicking everything they see on the screen ten times over if the result does not pop up in milliseconds after? Well, the ajax requests are lost, the data is never getting sent or received correctly, error 500 starts to show up with alarming frequency, etc. and all your mighty enterprise solutions you've been developing for the past year and half go to a trash can and none of your arguments is helping. And it can get much worse if your app is supposed to work through the Internet where connection speed can be really slow for some users.


      One of the solutions I came up with was to intercept any ajax calls and show a little animated "loading" modal panel while the request is being processed automatically blocking the whole view in the meantime. Since I almost always use facelets for templating somewhere in one of the main xhtmls I added:


      <a4j:status onstart="#{rich:component('modal_status')}.show();return false;" onstop="#{rich:component('modal_status')}.hide();return false;" />
      <rich:modalPanel id="modal_status" width="220" autosized="true">
           <div id="status">


      And that's it. Now every time the data is beeing updated, something filtered, pages partially realoaded, etc. the modal panel just pops up and life becomes a wonder again.


      While this approach serves me well there are cases when I must avoid this modal panel because when it appears the forcus is lost or some small js events are ignored (for ex. column text filtering, multiple comboboxes, etc.). In these special cases I just point ajax events to some nonexistant status id using status="ignorestatus" attribute. While this helps, every time the request is sent with this fake status the AJAX Status component not found for AjaxComponent with id {callerId} warning appears in the log and I feel terrible for the pour thing.


      I've tried to add another <a4j:status id="ignorestatus" onstart="javascript:void(0);" onstop="javascript:void(0);" /> but then I get duplicate Id for a component _viewRoot:status error and the app goes down.


      The question is: How could the warning be avoided while ignoring the default status event? If it can't be done, are there any other options?


      Thanks in advance.