But the values shows all the assignments that were added
For example: if I add an employee say John to a task initially and come out of the resourceassignment editor. And again I go and add an employee namely Clara , then on the value parameter I get both John and Clara assignments records. I just want to get Clara's assignment on second time resource selection.
Is there any way to get only the currently selected records(Clara) and not along with the previously selected records?
Yes, there is a way, we have a parameter on finalizeCellEdit that has the old value of the field (you'll see it on the documentation as well, and from there, you can filter the difference to get only the new values. Would be something like this:
finalizeCellEdit : ({ oldValue, value }) => {
// Get only the new values selected
const newData = value.filter(value => !oldValue.some(oldItem => oldItem.id === value.id));
}
Are you able to share what your Gantt config looks like? I added a test column in our basic example with a fake timeout and it work just fine (without any errors), which version are you using??
{
type : 'resourceassignment',
width : 120,
showAvatars : true,
finalizeCellEdit : async({ oldValue, value }) => {
// Get only the new values selected
const newData = value.filter(value => !oldValue.some(oldItem => oldItem.id === value.id));
await new Promise(resolve => setTimeout(resolve, 3000));
return true;
}
}
Also, there is a possible scenario when you don't have ValidationResponse in your code, it doesn't return either true or false.