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

Unique resource list per task item

When on the Task Information dialog is it possible to have a filtered version of the resource list based on the selected task when editing resources in the Resource tab?

1 Reply

PP Pooja Priya Krishna Moorthy Syncfusion Team July 12, 2019 03:49 AM UTC

Hi Ernst, 
 
In Gantt, already we are done some validations on resource collection on edit dialog. So we can’t directly achieve this, but this can be achievable in some workaround. 
We have achieved your requirement by using actionComplete event with argument requestType  property value as openEditDialog and by using beginEdit event of resource edit Treegrid in dialog. 
This workaround solution will affect the current behavior of resource edit Grid. 
Please find the code example below. 
 
 
   $("#gantt").ejGantt({ 
                //... 
                actionBegin: function (args) { 
                    if (args.requestType == "openEditDialog") { 
                        var ganttObj = $("#gantt").ejGantt("instance"); 
                        var obj = $("#treegrid" + ganttObj._id + "resourceEdit").ejTreeGrid("instance"); 
                        obj.model.beginEdit = function (args) { 
                            var columns = this.model.columns; 
                            var resources = [ 
                                { resourceId: 1, resourceName: "Project Manager" }, 
                                { resourceId: 2, resourceName: "Software Analyst" }, 
                            ]; // New resource collection 
                            var dropDownData = columns[0].dropdownData = $.extend(true, [], resources); 
                            var dataSource = this.model.dataSource; 
                            var value = args.data.item.name; 
                            for (var i = 0; i < dataSource.length; i++) { 
                                if (value != dataSource[i].name) { 
                                    var index = $.map(dropDownData, function (data, index) { 
                                        if (data["resourceId"].toString() == dataSource[i].name) { 
                                            return index; 
                                        } 
                                    }); 
                                    dropDownData.splice(index[0], 1); 
                                } 
                            } 
                            if (dropDownData.length <= 1) { 
                                ganttObj.enbleDisableAddResourceButton('disable', "beginEdit"); 
                            } 
                        } 
                    } 
                }, 
        }); 
 
Please find the below sample link. 
 
Regards, 
Pooja Priya K 
 


Loader.
Live Chat Icon For mobile
Up arrow icon