Product: Scheduler Pro 4.1.0
In the event editor, we are able to select multiple resources. Can we restrict to select only one resource?
Seems we have a small bug preventing this. Once https://github.com/bryntum/support/issues/2697 is fixed, you can use:
const scheduler = new SchedulerPro({
features : {
taskEdit : {
items : {
generalTab : {
items : {
resourcesField : {
multiSelect : false
}
}
}
}
}
}
})
Hey Matt, i have used following snipped in salesforce lwc. Please note that i will be adding resources at task row level.
Problem # 01: Select one resource from given resources list against task row
Problem # 02: We have one column in gantt chart tasks named "Team" which is dropdown with values of "Team1, Team2" etc. Please nore that Team1 has different resources, Team2 has different resources and so on. We want to render resources value at each task row based on the selected team. Once resources column render based on selected team, we want to select one resource. Resources rendering logic should work once gantt chart is loaded with predefined team value or if user change the team value, update the resources list against that row.
Can you help me with these problem statements?
const gantt = new bryntum.gantt.Gantt({
tree: true,
transformFlatData: true,
features : {
taskEdit : {
items : {
generalTab : {
items : {
resourcesField : {
multiSelect : false
}
}
}
}
}
}
})
Hi muhabbil,
The solution above is provided for SchedulerPro. Gantt doesn't support singleAssignment mode.
I am afraid, to reach that you'll need to override all UI components that allow to assign resources, or hide them and use your own implementation instead.
Here is the guide how to customize TaskEditor https://bryntum.com/products/gantt/docs/guide/Gantt/customization/taskedit#customizing-the-tabs-and-the-fields
All the best,
Alex
Hi muhabbil,
Sorry for ignoring #2, looks like I posted before finished.
Few mre words about #1.
You don't need to override taskEditor, you need to customize/replace field that used to select resource.
Second place to change is https://bryntum.com/products/gantt/docs/api/Gantt/column/ResourceAssignmentColumn. You'll need to replace it with single selection combo with resources list. As far as I understood, #2 is exactly about that.
There might be required to change logic on data level too, beforeAdd
, beforeUpdate
events of a store will help to add tricks.
I cannot give you ready solution, unfortunately. We never did it before. But we can assist with problems you face during your development. We also have Professional Services, if you want us to implement it for you https://www.bryntum.com/services
#2 As far as I understood, you have 2 columns: 1st for team and 2nd for resource.
When you select team, you need to filter resources to have only those who belong to the team.
Basically, you need to use https://bryntum.com/products/gantt/docs/api/Gantt/feature/CellEdit#event-beforeCellEditStart event, and apply filter for editor.store
according to record.team
value.
Here is a pseudo code to show what I meant.
gantt.on('beforeCellEditStart', ({ editorContext }) => {
if (editorContext.column.field != 'resources') {
return true;
}
editorContext.editor.store.clearFilters();
editorContext.editor.filter((r) => r.team === editorContext.record.team);
})
https://bryntum.com/products/gantt/docs/api/Core/data/Store#function-filter
https://bryntum.com/products/gantt/docs/api/Core/data/Store#function-clearFilters
All the best,
Alex
I've opened a feature request to add a demo with single assignment mode in Gantt https://github.com/bryntum/support/issues/6235
All the best,
Alex