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.

Unique resource list per task item

Thread ID:

Created:

Updated:

Platform:

Replies:

145842 Jul 10,2019 11:42 AM UTC Jul 12,2019 03:49 AM UTC jQuery 1
loading
Tags: ejGantt
Ernst Thomas Kvadsheim SemJacobsen
Asked On July 10, 2019 11:42 AM UTC

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?

Pooja Priya Krishna Moorthy [Syncfusion]
Replied On 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 
 


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