Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

setDisplayTemplate() returns java.lang.NullPointerException

Hi Experts,

I am getting a javascript error (java.lang.NullPointerException) when trying to update the display template of a chart at runtime through JavaScript. We are doing this on another applet with no problems. Here is the code (for some reason SCN is now showing the code so I attached as an image):

<object id="TagChart" name="TagChart" codebase="/XMII/Classes" Code="iChart" archive="illum8.zip">

<param name="QueryTemplate" value="Base_Metals/Ontario/TestQuery">

<param name="DisplayTemplate value="Base_Metals/Ontario/TestChart">

</object>

<script type="text/javascript">

alert(document.TagChart.getDisplayTemplate()); //return the string message: Base_Metals/Ontario/TestChart

document.TagChart.setDisplayTemplate("Base_Metals/Ontario/Test2Chart"); //returns java.lang.NullPointerException

</script>

Setting the DisplayTemplate to an empty string causes no errors so maybe it has something to do with the forward slashes (/) ?

Appreciate any help on the matter.

Thank you,

Corey

Vale

MII Version: 14.0 SP6 Patch 9

Message was edited by: Corey Jackson

Mii_code.png (16614 B)
Tags:
Former Member
Former Member replied

I solved the issue. The issue was due to an invalid display template specified to be set.  If the template does not exist JavaScript will throw the exception java.lang.NullPointerException.  If the template exists then no error will occur.

Corey

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question