I need a method like "onAfterAjax"

I want to show loading proccess of all requestr in one place. I know there is a onBeforeAjax method, so i may show loading process, but i don't know any method that i may use to hide loading process after request is done

Tagged:

Comments

  • There is no a single point to catch end of all ajax requests.

    Technically, it possible to create a custom proxy, that will provide the necessary handler.

    http://docs.webix.com/desktop__server_proxy.html

  • Is it needed to manually add to every ui object that interacts with ajax?

  • you can add a custom event handler to any view, or you can create a proxy, and just use the different way of URL writing, something like

    url:"custom->some.php"

  • Also, you can redefine webix.ajax.$callback, this one is called after each successful request.

  • Thanks a lot! I've done my task using redefining webix.ajax.$callback

  • how to redefine webix.ajax.$callback ?

  • Hello,
    As a solution, you can catch the global onBeforeAjax event (it will be triggered for all requests from the API):

    webix.attachEvent("onBeforeAjax", 
        function(mode, url, params, x, headers, files, defer){
       //x is request object
       //defer is promise created for the request
    
       defer.then(function(data){
         console.log("response", data.json());
       }, function(x){
         console.log("err", x)
       });
    
    });
    

    Please, check the following snippet:
    https://snippet.webix.com/o5eaa94n

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!