We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Unable to bind to events (ActionComplete, ToolbarClick, etc...)


I'm trying to bind to the toolbarClick event in the gantt chart, I've been able to successsfully do so in other EJ2 modules, 
but with the gantt chart I get this error: "Uncaught ReferenceError: toolbarClick is not defined"
This happens with all events I try to bind to, here is the code generated from the razor page:

<div id ='GanttContainer'></div>
<script>var Ganttf3ulv41qxjb=new ejs.gantt.Gantt({
  "treeColumnIndex": 1,
  "width": "100%",
  "toolbarClick": toolbarClick

    function toolbarClick(args) {

1 Reply

GA Gurunathan A Syncfusion Team August 14, 2019 06:37 AM UTC

Hi Ernst, 
We have checked the provided code snippets, this issue occurs due to using multiple script tags, toolbarClick event function and Gantt initialization are done on two different script tags. So the toolbarClick function was not known in second script tag. To overcome this issue add event handler function and Gantt initialization in same script tag or else define event handler as global functions. We have prepared a sample and defined event handler as global inside the window object. Please find code snippets for this below. 
        window.toolbarClick = function () { 
<script type="text/javascript"> 
var ganttChart = new ejs.gantt.Gantt({ 
            toolbarClick: window.toolbarClick, 
Please find the sample from below link . 

Live Chat Icon For mobile
Up arrow icon