We are trying to use the pivot table component within Salesforce Lightning Web Components and are receiving some errors.
Here's the Javascript code we are using:
import { LightningElement } from 'lwc';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
import xsslds from '@salesforce/resourceUrl/xsslds221'; // Adjust path
export default class Xs_global_analysis extends LightningElement {
isRendered = false;
renderedCallback() {
if (this.isRendered) {
return;
}
this.isRendered = true;
Promise.all([
loadScript(this, xsslds + '/flexmonster.js'),
loadStyle(this, xsslds + '/flexmonster.css')
])
.then(() => {
const pivotContainer = this.template.querySelector('.pivot-container');
if (pivotContainer) {
const pivot = new Flexmonster({
container: pivotContainer,
width: "100%",
height: "100%",
toolbar: true,
report: {
dataSource: {
data: this.getData()
}
}
});
}
})
.catch(error => {
console.error('Error loading Flexmonster:', error);
});
}
getData() {
return [{"Account Name":"Xceede India","FY2025F06":20,"Category":"Actual","Offerings":"Implementation - Inner 1","Offerings Parent":"Implementation","Fiscal Period":"JAN-25","Fiscal Quarter":"Q1","Fiscal Year":"FY2025","Measure":"Revenue - Services","Measure Parent":"Revenue","Plan Source":"Account Planning"}];
}
}