0

I am trying to emulate the Primefaces Showcase to have a result set that uses filtering and a row expansion. I get errors whenever I try either one. The page loads without errors. In the code example, I have stripped the filtering to isolate the issue. It appears that any time an AJAX request is triggered it will give an error. The error is triggered when trying to use the row expansion as that uses an AJAX call to fetch the expanded row.

We are using Primefaces 8.0 on IBM Rad local server (Eclipse). Result set is pulled from DB2 using Hibernate and that part works.

Please help by suggesting why the AJAX fails everytime?

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </h:head> <h:body> <ui:composition template="/template/maintemplate.xhtml"> <ui:define name="title">Search Results</ui:define> <ui:define name="content"> <h:form id="formId"> #{searchResultsBean.init} <p:dataTable id="parameterList" var="data" value="#{searchResultsBean.parameterList}"> <p:column style="width:16px"> <p:rowToggler /> </p:column> <p:column value="#{data.companyId}" > <f:facet name="header"> <h:outputText value="Company ID" /> </f:facet> <h:outputText value="#{data.companyId}" /> </p:column> <p:column value="#{data.companyName}" > <f:facet name="header"> <h:outputText value="Company Name" /> </f:facet> <h:outputText value="#{data.companyName}" /> </p:column> <p:column value="#{data.alertNumber}"> <f:facet name="header"> <h:outputText value="Alert Number" /> </f:facet> <h:outputText value="#{data.alertNumber}" /> </p:column> <p:column value="#{data.comment}"> <f:facet name="header"> <h:outputText value="Comment" /> </f:facet> <h:outputText value="#{data.comment}" /> </p:column> <p:rowExpansion> <p:panelGrid columns="2" columnClasses="label,value" style="width:300px"> <h:outputText value="Company ID" /> <h:outputText value="#{data.companyId}" /> <h:outputText value="Company Name" /> <h:outputText value="#{data.companyName}" /> <h:outputText value="Alert #" /> <h:outputText value="#{data.alertNumber}" /> <h:outputText value="Alert Description" /> <h:outputText value="$#{data.alertNumber}" /> </p:panelGrid> </p:rowExpansion> </p:dataTable> </h:form> </ui:define> </ui:composition> </h:body> </html> 

Error received in console:

ReferenceError: ajaxWaitCursorOn is not defined 

Specific error in primefaces generated javascript:

$(function(){PrimeFaces.cw("AjaxStatus","widget_j_id878804506_56ad391e",{id:"j_id878804506_56ad391e",delay:0,start:function(){ajaxWaitCursorOn()},success:function(){ajaxWaitCursorOff()}});}); 

Note 1: We tried changing it to use @Inject instead of calling the init method and got the same result.

Note 2: We verified that jQuery is loaded using a simple alert in the console.

4
  • ajaxWaitCursorOn is a method in your code, check why its not loaded if you use it in p:ajaxStatus Commented Nov 4, 2021 at 14:51
  • It is a method in primefaces generated code, not my code. Commented Nov 4, 2021 at 15:15
  • Could you show your backend? and review if you only have one primefaces lib in your classpath Commented Nov 4, 2021 at 16:33
  • Thanks ivasanpag, I also thought the same and verified all of that this morning. I found the issue, it was code in a template that we were loading. We copied that part from another project. Going to answer my own question. Commented Nov 4, 2021 at 16:52

1 Answer 1

1

The issue was this line above: template="/template/maintemplate.xhtml

It was loading a template file. We didn't make this, but copied it from another project. The template file had this line in for some reason: <p:ajaxStatus onstart="ajaxWaitCursorOn()" onsuccess="ajaxWaitCursorOff()" />

I am not sure if this answer provides value to anyone except for this: Check your template files if you have any.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.