Fix jquery error & h.indexof is not a function

Answered
bernard dradeou asked on June 14, 2021

Hi there,
 
   i have upgraded to the last stable version of angular and flex 2.9.
   I get 2 errors i can't fix myself:

  • Uncaught ReferenceError: jQuery is not defined
    at jquery.simulate.js:331   ==> get this at app startup time
  • ERROR Error: Uncaught (in promise): TypeError: h.indexOf is not a function
    TypeError: h.indexOf is not a function
    at Function.Bra (flexmonster.full.js:41)  ==> get this when load report

    What may be a possible quick solution ? Downgrade angular and/or flex perhaps ? See project in attach. Thank you !
 
regards,
Bernard
 

Attachments:
Reporting.zip

1 answer

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster June 14, 2021

Hello,
 
Thank you for reaching out to us and for preparing the project.
 
The "jQuery is not defined" exception is not reproducible in our case. Also, this error does not seem to be connected with Flexmonster. If you think it is entailed by Flexmonster update, please provide us with corresponding details (a project with reproducible error, screenshots, etc.).
 
The "h.indexOf is not a function" error is caused by the wrong argument passed to the load method. Please note that the load API call only accepts links to the JSON file containing the report. In your case, the inline JSON object is passed as an argument:

const csv = await this.httpClient.get('getReport')
const report = JSON.parse(JSON.stringify(csv))
console.log(report);
this.pivot?.flexmonster.load(report)

Instead, use the setReport API call that serves to apply report from the inline JSON object:

const csv = await this.httpClient.get('getReport')
const report = JSON.parse(JSON.stringify(csv))
console.log(report);
this.pivot?.flexmonster.setReport(report)

In this case, the exception does not appear.
 
Please let us know if it helps.
 
Best regards,
Illia

Please login or Register to Submit Answer