简体   繁体   中英

how to learn the primefaces javascript API?

While learning JSF-2.2 with PrimeFaces 5.3 I came across javascript events handlers like the one used with onComplete attribute:

function handelSmptmSaveRequest(xhr, status, args) {
                            if (args.validationFailed) {
                                PF('smptmDlgWv').jq.effect("shake", {
                                    times : 5
                                }, 100);
                            } else {
                                PF('smptmDlgWv').hide();
                            }
                        }

I have multiple questions here:

  1. What are the input variable xhr, status, args and where are they defined, and where do they get their values from?
  2. Is this the only handler I need to use with jsf components events such as onBlur or onClick , and how can I learn them?
  3. Is there any documentation for this? I came from Java SE where every thing is documented and explained, where to look for javascript documentations and how?

Edit1 This appears to be Ajax callbacks defined by PrimeFaces, and They're announced here http://blog.primefaces.org/?p=830 but there is still a problem, though the PF showcase has some examples of usage, but I can't fine do documentation for these functions, I'm adding ajax tag for the question.

Here is the PrimeFaces 5.3 documentation , in PDF form. (Here are docs for all versions. )

Page 536 documents the parameters for the oncomplete(xhr, status, args) function:

Javascript callback to process when ajax request completes. Takes three arguments, xmlhttprequest, status string and optional arguments provided by RequestContext API.

XMLHttpRequest is the vanilla JS Object that we all know and love.

RequestContext is defined on page 588 of the PrimeFaces 5.3 documentation:

RequestContext is a simple utility that provides useful goodies such as adding parameters to ajax callback functions. RequestContext is available in both ajax and non-ajax requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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