最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - PrimeFaces.ab function - Stack Overflow

programmeradmin1浏览0评论

Cant seem to find documentation for PrimeFaces.ab function

PrimeFaces.ab({source:'signupForm:signupButton'});
return false;

Can anybody help me with what the code above is meant to do? It has been written against the onclick of a submit button.

Cant seem to find documentation for PrimeFaces.ab function

PrimeFaces.ab({source:'signupForm:signupButton'});
return false;

Can anybody help me with what the code above is meant to do? It has been written against the onclick of a submit button.

Share Improve this question asked Apr 12, 2014 at 14:20 Muhammad TauseefMuhammad Tauseef 4332 gold badges6 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 16

The PrimeFaces.ab function is a shortcut function for PrimeFaces.ajax.AjaxRequest.

    //ajax shortcut
    ab: function(cfg, ext) {
        return PrimeFaces.ajax.AjaxRequest(cfg, ext);
    }

The PrimeFaces.ajax.AjaxRequest can be asynchronous or synchronous. The AjaxRequest uses the AjaxUtils, which handles all send, process, response, and update.

PrimeFaces.ajax.AjaxRequest = function(cfg, ext) {
    cfg.ext = ext;

    if(cfg.async) {
        return PrimeFaces.ajax.AjaxUtils.send(cfg);
    }
    else {
        return PrimeFaces.ajax.Queue.offer(cfg);
    }
}

Passing a cfg (configuration) object to the PrimeFaces.ajax.AjaxUtils.send(cfg), this cfg object has:

  • cfg.global: a boolean value used to trigger p:ajaxStatus if it's a true.
  • cfg.onstart: to be called when the request is to be send.
  • cfg.async: a boolean value, where if this call is asynchronous or not.
  • cfg.source: can be a client id or an element defined by this keyword
  • cfg.formId: if an explicit form is defined, or it would look into a parent source
  • cfg.resetValues
  • cfg.ignoreAutoUpdate
  • cfg.fragmentId: used for the process of the components
  • cfg.fragmentUpdate
  • cfg.event: behaviour event, like click or change
  • cfg.params: request params
  • cfg.partialSubmit: if partial submit is enabled, there are components to process partially
  • cfg.onerror: to be called when the request had an error status.
  • cfg.onsuccess: to be called when the request had a success status.
  • cfg.oncomplete: to be called when the request is completed.

Note: I came up with this explanation based on my understanding of the source code.

Also you can refer to this answer, might be helpful.

发布评论

评论列表(0)

  1. 暂无评论