Hi ,
How can we give conditions for assigning a resource to a task in both resourceAssignment column as well as in assignment tab of taskEditor .
for example if we try to assign a resource to a task then few condition has to be checked if the condition are satisfied then the resource should be added , else choose another resource toast has to be shown . Where can these operations be handled in both resourceAssignment column as well as in assignment tab of taskEditor
Support Forum
It can be done on data level using preventable events like
https://bryntum.com/docs/gantt/api/Gantt/data/AssignmentStore#event-beforeUpdate
https://bryntum.com/docs/gantt/api/Gantt/data/AssignmentStore#event-beforeAdd
on UI level, since its 2 different components, you'll need to handle it in 2 places.
For https://bryntum.com/docs/gantt/api/Gantt/column/ResourceAssignmentColumn you will need to add listener for editor
which is https://bryntum.com/docs/gantt/api/Gantt/widget/AssignmentField class by default.
Here is code snippet how to apply configs for that editor https://bryntum.com/docs/gantt/api/Gantt/widget/AssignmentField#customizing-the-drop-down-grid
It has https://bryntum.com/docs/gantt/api/Gantt/widget/AssignmentField#event-change event that you could listen to and revert change if not valid.
For taskEditor customization, please check this guide https://bryntum.com/docs/gantt/guide/Gantt/customization/taskedit#customizing-the-tabs-and-the-fields
resourceTab
has grid
, that's what you'll need to use with your custom config with listener.
Another way to validate cell editing, which may be easier to use here, is subscribe on https://bryntum.com/docs/gantt/api/Grid/feature/CellEdit#event-beforeFinishCellEdit , check column type (available it params list) and validate user changes.
All the best,
Alex