Hi,
Is it possible to change resource assignment type from multiple to single ? i.e. Radio button instead of checkbox or restricting choosing multiple resources per task.
|
<script>
function actionComplete(args) {
if ( args.requestType == "openAddDialog" || args.requestType == "openEditDialog") {
var tabObj = document.getElementById("resource_Tab").ej2_instances[0];
tabObj.selected = function (args) {
if (args.selectedItem.innerText == "RESOURCES") {
var resourceTab = document.getElementById("resourceResourcesTabContainer_gridcontrol").ej2_instances[0];
resourceTab.selectionSettings = {
checkboxOnly: false,
type: "Single",
persistSelection: false
};
}
};
}
}
</script>
|
|
function actionComplete(args) {
if (args.requestType == "openAddDialog" || args.requestType == "openEditDialog") {
var tabObj = document.getElementById("resource_Tab").ej2_instances[0];
tabObj.selected = function (args) {
if (args.selectedItem.innerText == "RESOURCES") {
var resourceTab = document.getElementById("resourceResourcesTabContainer_gridcontrol").ej2_instances[0];
resourceTab.columns.splice(0, 1);
resourceTab.selectionSettings = {
type: "Single",
persistSelection: false
};
}
};
|
Hi,
Thanks, it worked but there is a side effect: Already assigned resource is not in selected after opening resource dialog. Is there an option for that ?
"At present, we do not have the support to prevent the multi-select at cell editing(on Treegrid) "
So, is there a way to prevent cell editing (treegrid) but allow dialog editing for that particular field ?
|
function cellEdit(args) {
if (args.columnName == "Resources") {
args.cancel = true;
}
} |
|
function actionComplete(args) {
if (ganttArgs.requestType == 'openEditDialog') {
//To maintain selected resources in resource tab
var resources = ganttObj.selectionModule.getSelectedRecords()[0].ganttProperties.resourceInfo;
var currentViewData = resourceTab.getCurrentViewRecords();
currentViewData.forEach(function (data, index) {
for (var i = 0; i < resources.length; i++) {
if (data.taskData[ganttObj.resourceFields.id] === resources[i][ganttObj.resourceFields.id]) {
resourceTab.selectRow(index);
}
}
});
}
} |
# Resource Assignment Example in Python
# List of employees
employees = ["Ali", "Sara", "John", "Aisha"]
# List of tasks
tasks = ["Prepare report", "Conduct training", "Update database", "Schedule interviews"]
# Assign tasks to employees (round-robin assignment)
assignment = {}
for i, task in enumerate(tasks):
employee = employees[i % len(employees)]
assignment[task] = employee
# Display the assignments
print("Resource Assignment:")
for task, employee in assignment.items():
print(f"- {task} → {employee}")
This code ensures that tasks are distributed evenly among employees using a simple round-robin method. If you're working on a project or need help with HR-related coding for your coursework, especially this kind of example can be very useful. Let me know if you want it tailored for more complex scenarios like skill matching or availability.
Hi Liam,
Thank you for your response.
Please contact us if you require any further assistance.
Regards,
Ajithkumar G