Enable/Disable Planned Start and Planned End columns on Planned Tasks Toggle button click

1 Answer 77 Views
Gantt
Abhishek
Top achievements
Rank 1
Iron
Abhishek asked on 10 Nov 2023, 12:20 AM

HI,

I have a requirement to disable the Planned Start and Planned End column when the user clicks on Planned Task to show Planned on Gantt view and to enable columns for editing when the user hides Planned on Gantt view

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 14 Nov 2023, 11:51 AM

Hi Abhishek,

to achieve the desired behavior you can handle the togglePlannedTasks event:

- https://docs.telerik.com/kendo-ui/api/javascript/ui/gantt/events/toggleplannedtasks

In the event handler, you can access the needed columns and set their editable property to true/false. You can set the updated options using the setOptions method:

togglePlannedTasks: function(e) {
              var columns = e.sender.options.columns
              if(!e.showPlannedTasks){                
                setTimeout(function(){
                  var plannedStart = columns.find(e => e.field == "plannedStart")
                  var plannedEnd = columns.find(e => e.field == "plannedEnd")
                  plannedStart.editable = true;
                  plannedEnd.editable = true;
                  e.sender.setOptions({
                    columns: columns,
                    showPlannedTasks: false
                  })
                })
              }else{
                setTimeout(function(){
                  var plannedStart = columns.find(e => e.field == "plannedStart")
                  var plannedEnd = columns.find(e => e.field == "plannedEnd")
                  plannedStart.editable = false;
                  plannedEnd.editable = false;
                  e.sender.setOptions({
                    columns: columns,
                    showPlannedTasks: true
                  })
                })
              }
            }

Here you will find a Dojo example where this is demonstrated - https://dojo.telerik.com/@NeliKondova/AKUpEcaY.

 

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Abhishek
Top achievements
Rank 1
Iron
commented on 15 Nov 2023, 04:33 AM

Thanks @Neli. It's working
Tags
Gantt
Asked by
Abhishek
Top achievements
Rank 1
Iron
Answers by
Neli
Telerik team
Share this question
or