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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

146673 Aug 13,2019 02:19 PM UTC Aug 14,2019 06:37 AM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Gantt Chart
Ernst Thomas Kvadsheim SemJacobsen
Asked On August 13, 2019 02:19 PM UTC

Hi

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
});
Ganttf3ulv41qxjb.appendTo("#GanttContainer"); 
</script>

<script>
    function toolbarClick(args) {
        console.log(args);
    }
</script>

Gurunathan A [Syncfusion]
Replied On 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. 
 
 
<script> 
        window.toolbarClick = function () { 
            //... 
        } 
</script> 
<script type="text/javascript"> 
var ganttChart = new ejs.gantt.Gantt({ 
            //... 
            toolbarClick: window.toolbarClick, 
        }); 
ganttChart.appendTo('#Gantt'); 
</script> 
 
 
Please find the sample from below link . 
 
Regards, 
Gurunathan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon