2

I am trying to understand how the flowing request works, I am new in primeFaces so please excuse me if it's too basic question.

  • The request send ID and date of birth to the server, and I don't understand how it works(onclick, onstart...).
  • What is the differences between PrimeFaces.ab and PrimeFaces.cw?

enter image description here

<button id="scheduleForm:tabViewId:searchIcon" name="scheduleForm:tabViewId:searchIcon" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.ab({source:'scheduleForm:tabViewId:searchIcon',
update:'scheduleForm:tabViewId:panelInfoPessoal scheduleForm:postPanelGroup scheduleForm:postcons scheduleForm:infoAgendamento scheduleForm:listaAtos scheduleForm:preRegPanelGroup scheduleForm:SGCMessage',
onstart:function(cfg){loadingDlg.show();},oncomplete:function(xhr,status,args){loadingDlg.hide();;}});return false;" style="align: right; width: 20%; min-width: 120px;vertical-align: middle;margin:0 auto" type="submit"><span class="ui-button-text">Pesquisar</span></button><script id="scheduleForm:tabViewId:searchIcon_s" type="text/javascript">PrimeFaces.cw('CommandButton',
'widget_scheduleForm_tabViewId_searchIcon',{id:'scheduleForm:tabViewId:searchIcon'});</script></div><div id="scheduleForm:tabViewId:tab_gov" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-helper-hidden" role="tabpanel" aria-hidden="true"><table id="scheduleForm:tabViewId:panelLogin" style="text-align: center; font-size: 12pt; vertical-align: middle; margin:0 auto; padding-top: 1%; padding-bottom: 2%;">
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Elior
  • 41
  • 5

1 Answers1

3

The PrimeFaces Ajax API is documented here https://primefaces.github.io/primefaces/10_0_0/#/core/ajaxJavascriptApi and here https://primefaces.github.io/primefaces/jsdocs/modules/src_primefaces.primefaces.ajax.html

PrimeFaces.ab is short for PrimeFaces.ajax.Request.handle which handles Ajax requests.
PrimeFaces.cw is short for PrimeFaces.createWidget which will create a widget (which is used by most of the PrimeFaces components, basically the JavaScript API for a component instance).

As a user of PrimeFaces components you are not required to know all the ins and outs of the core JavaScript. It will help in more complex scenarios, but as a beginner I would not focus on that.

To start of, I recommend you start with reading Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102