BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi all,
I am following the dashboard code sample from this URL: https://ej2.syncfusion.com/react/demos/?_ga=2.3960944.1770497451.1626917988-586964544.1625034816#/material/dashboard-layout/dynamic
I am also currently using the packages below:
"@syncfusion/ej2-base": "^18.4.44",
"@syncfusion/ej2-react-buttons": "^18.4.46",
"@syncfusion/ej2-react-charts": "^19.2.47",
"@syncfusion/ej2-react-dropdowns": "^18.4.48",
"@syncfusion/ej2-react-grids": "^18.4.47",
"@syncfusion/ej2-react-inputs": "^18.4.47",
"@syncfusion/ej2-react-layouts": "^19.2.48",
"@syncfusion/ej2-react-lists": "^18.4.39",
"@syncfusion/ej2-react-popups": "^18.4.44",
"@syncfusion/ej2-react-progressbar": "^18.4.39",
"@syncfusion/ej2-react-splitbuttons": "^18.4.41",
"react": "^17.0.1",
I encountered an error when I try to replace 'content' property with a JSX element as shown below:
const TestJSX = () => {
return <button>save</button>;
};
const onAdd = (args: any) => {
let panel: PanelModel[] = [
{
id: 'p-' + Math.random(),
sizeX: 1,
sizeY: 1,
row: 0,
col: 0,
header: '
',
content: TestJSX as any,
},
];
dashboardObj?.addPanel(panel[0]);
};
TypeError: str.match is not a function
evalExp
C:/Users/ChongWeiWee/Documents/Projects/OTSiem-UI/node_modules/@syncfusion/ej2-layouts/node_modules/@syncfusion/ej2-base/src/template.js:73
70 | * Variable containing Local Keys
71 | */
72 | var localKeys = [];
> 73 | var isClass = str.match(/class="([^\"]+|)\s{2}/g);
| ^ 74 | var singleSpace = '';
75 | if (isClass) {
76 | isClass.forEach(function (value) {
To try and solve the issue, I have tried the steps below but the error persist:
const onAdd = (args) => {
var panel = [
{
id: "1",
sizeX: 1,
sizeY: 1,
row: 0,
col: 1,
header: "<div>Button component - 2</div>",
content: TestJSX
}
];
dashboardObj.current.addPanel(panel[0]);
};
|