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
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Hiding other resourceCenters with a specific background color when dragging a task

Thread ID:

Created:

Updated:

Platform:

Replies:

146562 Aug 8,2019 09:37 AM UTC Aug 21,2019 06:14 AM UTC jQuery 3
loading
Tags: ejGantt
xia
Asked On August 8, 2019 09:37 AM UTC

Hi syncfusion supporter

How hiding other resource centers with a specific background color when dragging a task?

Simple demonstration -- https://drive.google.com/open?id=1qttzkaQQg6Ew4AWHvZ1G9FIx4KJdWeNj

Pooja Priya Krishna Moorthy [Syncfusion]
Replied On August 12, 2019 03:41 AM UTC

Hi Xia,

 

Greetings from Syncfusion support.

 

We have prepared a sample in which, we can restrict the dragging of taskbar from one group to another by setting args.cancel as true in taskbarEdited event. But we can drag to different resources of same group. In the provided sample we differentiate, the different groups while dragging, by highlighting the restricted area. Please find the below code example.

 

  <style>

       .e-hiddenarea {

              background: pink

       }            

  </style>

  <script>

          var isUpdateHideArea = false;

          $("#resourceGantt").ejGantt({

                //...

                taskbarEdited: function(args) {

                      isUpdateHideArea = false;

                      $("#resourceGantt").find(".e-ganttrowcell").removeClass("e-hiddenarea");

                      if(args.assignedResource.groupId != args.previousResource.groupId) {

                             args.cancel = true;

                      }

                            

                },

              taskbarEditing: function(args) {

                      if(!isUpdateHideArea){

                             isUpdateHideArea = true;

                             updateHiddenArea(args.rowData);

                      }

              },              

         });

        });

       function updateHiddenArea(data){

                      var object =  $("#resourceGantt").ejGantt("instance");

                      var chartRows = $("#resourceGantt").find(".e-ganttrowcell");

                             chartRows.addClass("e-hiddenarea");

                      if(data.eResourceTaskType == "resourceChildTask"){

                             var parent = data.parentItem.parentItem;

                             var childs = parent.childRecords.slice();

                             childs.push(parent);

                             for(var i=0;i< childs.length;i++ ){

                                    var index= object.model.currentViewData.indexOf(childs[i]);

                                    $(chartRows[index]).removeClass("e-hiddenarea");

                             }

                      }

 

              }

        </script>

 

Please find the below sample link.

Link - https://jsplayground.syncfusion.com/grgjoue4

 

Regards,

Pooja Priya K.

 


xia
Replied On August 21, 2019 02:30 AM UTC

Hi Xia,

 

Greetings from Syncfusion support.

 

We have prepared a sample in which, we can restrict the dragging of taskbar from one group to another by setting args.cancel as true in taskbarEdited event. But we can drag to different resources of same group. In the provided sample we differentiate, the different groups while dragging, by highlighting the restricted area. Please find the below code example.

 

  <style>

       .e-hiddenarea {

              background: pink

       }            

  style>

  <script>

          var isUpdateHideArea = false;

          $("#resourceGantt").ejGantt({

                //...

                taskbarEdited: function(args) {

                      isUpdateHideArea = false;

                      $("#resourceGantt").find(".e-ganttrowcell").removeClass("e-hiddenarea");

                      if(args.assignedResource.groupId != args.previousResource.groupId) {

                             args.cancel = true;

                      }

                            

                },

              taskbarEditing: function(args) {

                      if(!isUpdateHideArea){

                             isUpdateHideArea = true;

                             updateHiddenArea(args.rowData);

                      }

              },              

         });

        });

       function updateHiddenArea(data){

                      var object =  $("#resourceGantt").ejGantt("instance");

                      var chartRows = $("#resourceGantt").find(".e-ganttrowcell");

                             chartRows.addClass("e-hiddenarea");

                      if(data.eResourceTaskType == "resourceChildTask"){

                             var parent = data.parentItem.parentItem;

                             var childs = parent.childRecords.slice();

                             childs.push(parent);

                             for(var i=0;i< childs.length;i++ ){

                                    var index= object.model.currentViewData.indexOf(childs[i]);

                                    $(chartRows[index]).removeClass("e-hiddenarea");

                             }

                      }

 

              }

        script>

 

Please find the below sample link.

Link - https://jsplayground.syncfusion.com/grgjoue4

 

Regards,

Pooja Priya K.

 


Thank you Pooja Priya K! Your code is working fine. I'm sorry to reply to you not in time, busy recently :)

Gurunathan A [Syncfusion]
Replied On August 21, 2019 06:14 AM UTC

Hi Xia, 
  
Thanks for the reply.  
  
We are always happy to assist you. 
  
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