Need a special offer?Find out if your project fits.
+

getData api not working for flat type of flexmonster grid

Answered
Nil asked on February 8, 2022

Hi Team,
 
Flexmonster getData is giving error below if grid type is flat 
We are running angular 11 anf Flexmonster 2.9.18
 
Error:
core.js:6142 ERROR TypeError: Cannot read properties of undefined (reading '0')
at b.WA (flexmonster.full.js:1534:406)
at b.I_ (flexmonster.full.js:835:385)
at b.expand (flexmonster.full.js:835:6)
at f.load (flexmonster.full.js:877:199)
at Function.zc (flexmonster.full.js:927:392)
at Function.d0 (flexmonster.full.js:927:491)
at f.getData (flexmonster.full.js:300:187)
at h.getData (flexmonster.full.js:280:270)
at k.getData (flexmonster.full.js:2354:28)
at Object.PivotApi.k.getData (flexmonster.full.js:2366:24)
 
Code:
this.pivot.flexmonster.getData(
      {
      },
      (data: any) => {
        console.log(data)
      }
    );

3 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster February 8, 2022

Hello, Nil!

Thank you for raising a ticket.
We would highly appreciate if you could provide us with more detailed information.
This could be one of the following:

  1. The report object for Flexmonster initialization.
  2. The code sample where the issue occurs.

Looking forwards to hearing from you.

Best Regards,
Maksym

Public
Nil February 9, 2022

Hi Maksym,
Kindly find the report object below .
{
"dataSource": {
"type": "api",
"url": "http://localhost:44397/api",
"index": "index-44"
},
"slice": {
"rows": [
{
"uniqueName": "ID"
},
{
"uniqueName": "Name"
}
],
"columns": [
{
"uniqueName": "[Measures]"
}
]
},
"options": {
"grid": {
"type": "flat",
"showFilter": false,
"showGrandTotals": "off"
}
},
"version": "2.9.18",
"creationDate": "2022-02-09T06:01:18.520Z"
}
Code = 
onReportComplete() {
this.pivot.flexmonster.getData(
{
type: "flat"
},
(data: any) => {
console.log(data)
}
);
}
 

Public
Maksym Diachenko Maksym Diachenko Flexmonster February 10, 2022

Hello, Nil!

Thank you for providing us with more details. We reproduced the described behavior on our side.

getData API call was added to pass aggregated data from the pivot table to 3rd party charting libraries. Currently, getData from a flat view is not supported for custom data source API. That being said, could you please provide more details on what are you trying to achieve? Understanding your use case would greatly help us.

We are looking forward to hearing from you.

Best Regards,
Maksym

Please login or Register to Submit Answer