KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

AjaxUrl in PivotMatrix #2329

Open Epitello opened this topic on on Sep 9, 2021 - 14 comments

Epitello commented on Sep 9, 2021

Hello team, I updated the koolreport / pro package but I don't understand how the new "ajaxUrl" parameter for the pivot matrix works. Prior to the update, pivot worked fine with custom URLs, but not anymore. thanks in advance

Sebastian Morales commented on Sep 10, 2021

Hi, "ajaxUrl" should only be used when you use PivotMatrix in a Single Page Application (Angular, React, etc), not in a separate report page. In your case don't set "ajaxUrl" if yours is not a SPA. If you don't set it and still have a problem pls let us know and provide report code, problem screenshots. Tks,

Epitello commented on Sep 24, 2021

Hi, We're using PivotMatrix with React. Before the update, the PivotMatrix update worked fine. We used the route prop in the scope to update object. The first rendered works fine (1st screenshot) but the drag and drop on a field occures the error.

Thanks

Sebastian Morales commented on Sep 27, 2021

Do you set the "ajaxUrl" property in PivotMatrix? If you don't, it's probably not "ajaxUrl" that makes your PivotMatrix in React not working. Version 8.0.0 also has a change in constructing "scope" argument for pivot update requests. We thought the new scope would be compatible and work with multi-level arrays instead of one-level arrays previously. If you happen to use "scope" property in your PivotMatrix let us know the exact code. Tks,

Epitello commented on Sep 27, 2021

Yes, I set the "ajaxUrl" property in PivotMatrix parameters.

In PivotMatrix.js, the HTTP request uses the "ajaxurl" whereas I set "ajaxUrl" property. Is it normal ?

Sebastian Morales commented on Sep 27, 2021

...

Sebastian Morales commented on Sep 27, 2021

No, pls don't set "ajaxUrl" unless you use a Single Page Application. By default, PivotMatrix sends update requests to the current url. Only set "ajaxUrl" in case you have other url other than the current one to update PivotMatrix.

Epitello commented on Sep 27, 2021

Yes, it is. We have an another url to update PivotMatrix but it doesn't seem work with the new version of KoolReport. What do we have to do ?

Sebastian Morales commented on Sep 28, 2021

Would you pls post the code where you use route prop in the scope to update PivotMatrix? Tks,

Epitello commented on Sep 28, 2021

Sebastian Morales commented on Sep 28, 2021

Pls open browser dev tool, tab Network, button XHR and check for PivotMatrix xhr request when you move fields. Look for the request's url and data, especially variables in your "scope" like "route". Let us know why the response is wrong with the request's url or data sent.

Epitello commented on Sep 28, 2021

The url requested is bad. It is the current url whereas we expect another url (set in "ajaxUrl").

The url's datas are correct.

Sebastian Morales commented on Sep 28, 2021

I think I found out where the error was. Pls open the file koolreport/pivot/widgets/assets/PivotMatrix.js and replace this line:

    oReq.open('POST', this.ajaxurl ? this.ajaxurl : global.location.href, true);

with this one:

    oReq.open('POST', this.ajaxUrl ? this.ajaxUrl : global.location.href, true);

"ajaxurl" is a typo for "ajaxUrl" like you mentioned in a previous post. After changing this, clear your project and browser caches for the new PivotMatrix.js file to load. Hope this helps!

Epitello commented on Sep 28, 2021

In which version this fix will be applied ? Thanks for help

Sebastian Morales commented on Sep 29, 2021

We have applied this fix for a development version and it will be available in the next released version of Pivot package and KoolReport Pro. Rgds,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

Pivot