Single resource assignment

Hello,

is there a way to restrict the number of resources assignable to a task to a single resource? 


Than


3 Replies

AK Alagumeena Kalaiselvan Syncfusion Team February 3, 2022 02:23 PM UTC

Hi Eliseo, 
  
Thanks for contacting Syncfusion support. 
  
Yes, you can restrict the multiple resources by doing the customization in actionBegin and actionComplete event of Gantt as like below code. We have modified the sample such that only single resources are selected. 
public actionBegin(argsany) { 
        if (args.requestType == "beforeOpenEditDialog" || args.requestType == "beforeOpenAddDialog") {  
            args.Resources.columns.splice(01);  
          }  
    } 
    public actionComplete(argsany) { 
        if ( 
            args.requestType == "openAddDialog" || 
            args.requestType == "openEditDialog" 
          ) { 
            var tabObj = (document.getElementById("resource_Tab"as any).ej2_instances[0]; 
            tabObj.selected = function(args) { 
              if (args.selectedItem.innerText == "RESOURCES") { 
                var resourceTab = (document.getElementById( 
                  "resourceResourcesTabContainer_gridcontrol" 
                ) as any).ej2_instances[0]; 
                resourceTab.selectionSettings = { 
                  checkboxOnly: false, 
                  type: "Single", 
                  persistSelection: false 
                }; 
              } 
            }; 
          } 
    } 
  
  
  
Please check with shared sample and let us know, if you need further assistance. 
  
Regards 
Alagumeena.K 



EF Eliseo Felcher February 3, 2022 03:37 PM UTC

Hi, thanks for your fast reply; i checked out your example, but it appears I am no longer able to select a resource to assign to the task




AK Alagumeena Kalaiselvan Syncfusion Team February 4, 2022 07:37 AM UTC

Hi Eliseo, 

Sorry for the inconvenience. 

We have investigated the shared sample and the issue occurs due to the mapping of wrong element Id for resource Tab which is modified in below sample. 

Please let us know for further assistance. 

Regards 
Alagumeena.K 


Loader.
Up arrow icon