Uploaded image for project: 'PUBLIC - Liferay Faces'
  1. PUBLIC - Liferay Faces
  2. FACES-3195

BootsFaces 1.1.3 Uncaught ReferenceError: jQuery is not defined

    Details

      Description

      Description

      This issue can be reproduced in Google Chrome, but not in Safari or FireFox, although it probably should be reproducible there. It is caused by an ordering problem – specifically, the datatables.min.js resource appears in the <head>...</head> section of the portal page before the jQuery resource is downloaded:

      Pluto Portal Page
      <script src="https://cdn.datatables.net/v/bs/jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/af-2.2.0/b-1.4.0/b-colvis-1.4.0/b-html5-1.4.0/b-print-1.4.0/cr-1.3.3/fc-3.2.2/fh-3.1.2/r-2.1.1/rr-1.2.0/sc-1.4.2/se-1.2.2/datatables.min.js"></script>
      <script type="text/javascript" src="/pluto/portal/bootsfaces-applicant/__rscom0x2liferay0x2faces0x2demo0x2bootsfaces0x2applicant0x2portlet0x21!-186741302%7C0?javax.faces.resource=jq%2Fjquery.js&amp;ln=bsf"></script>
      

      The code responsible for adding the datatables.min.js resource is DataTable.java. It calls the AddResourcesListener.addResourceIfNecessary(String url) method which somehow causes the resource to appear first.

      The problem occurs in both Pluto 2.0 and Liferay Portal 7.0 but is more easily/quickly reproduced on Pluto 2.0. With Liferay Portal 7.0, the JS console eventually becomes locked up and the browser tab must be exited due to non-responsiveness.

      Steps to Reproduce

      1. Edit the bootsfaces-applicant-portlet/pom.xml descriptor and upgrade to BootFaces 1.1.3.

      2. Deploy the bootsfaces-applicant-portlet to Pluto 2.0

      3. Using Chrome, add the bootsfaces-applicant-portlet to a portal page

      4. Reload the portal page

      Expected Results

      No errors in the Chrome console log.

      Actual Results

      Uncaught ReferenceError: jQuery is not defined
          at datatables.min.js:74
          at datatables.min.js:74
      bootsfaces-applicant:2339 Uncaught TypeError: Pluto_com_liferay_faces_demo_bootsfaces_applicant_portlet_1__186741302_0_UploadedFilesTableWidget.DataTable is not a function
          at HTMLDocument.<anonymous> (bootsfaces-applicant:2339)
          at i (__rscom0x2liferay0x2faces0x2demo0x2bootsfaces0x2applicant0x2portlet0x21!-186741302|0?javax.faces.resource=jq%2Fjquery.js&ln=bsf:2)
          at Object.fireWith [as resolveWith] (__rscom0x2liferay0x2faces0x2demo0x2bootsfaces0x2applicant0x2portlet0x21!-186741302|0?javax.faces.resource=jq%2Fjquery.js&ln=bsf:2)
          at Function.ready (__rscom0x2liferay0x2faces0x2demo0x2bootsfaces0x2applicant0x2portlet0x21!-186741302|0?javax.faces.resource=jq%2Fjquery.js&ln=bsf:2)
          at HTMLDocument.J (__rscom0x2liferay0x2faces0x2demo0x2bootsfaces0x2applicant0x2portlet0x21!-186741302|0?javax.faces.resource=jq%2Fjquery.js&ln=bsf:2)
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: