Hey all, I am currently working on creating a dash...
# suitescript
l
Hey all, I am currently working on creating a dashboard suitelet to visualize data using the chartjs library, currently the chart that I am creating is not rendering and I am not too sure why.
{                id: 'scripttopop',
label: 'Script to populate canvas',
type: serverWidget.FieldType.INLINEHTML,
breakType: serverWidget.FieldBreakType.STARTROW,
layoutType: serverWidget.FieldLayoutType.OUTSIDEBELOW,
`defaultValue: `<canvas id="mychart" width="100px" height="50px></canvas><script type="text/javascript" src="url in the file cab for the chartjs lib">const myChart = new Chart(document.getElementById('mychart'),${config});</script>``
}
If someone could either help me figure out why this isn't rendering, or point me in the direction of a different lib that would be great!
z
I would test INLINEHTML fieldType... I am afraid that NetSuite stop with rendering INLINEHTML fields... just replace defaultVaue with <p>Chart goes here</p>
next step : check if the script from INLINEHTML executes... <script>console. log('It works') </script>
If above tests are positive, open Chrome debugger console and open your page to see if any error arrives
l
It looks like both of those are working, however the script is only getting executed when there isn't an src in the tag
z
I thought you simplified example... of course, that can't be written on that way script tag has two purpose : loading scripts and defines inline code <script src=.... /> <script type...... > console.log() </script>
and finally, just try to find article how to use jQuery in NetSuite client script... it is horror 😢... I am pointimg you to $ in ypur script.... maybe it should be (jQuery)
l
I appreciate your help I figured it out! and the ${config} represents a variable earlier in my script, would there be any way to access that without redefining variables within the inline html?