Hello bryntum team,
We have a specific requirement: to assign a task to multiple people, and then assign some working hours to each person. In your use case, I have several functions that I cannot find corresponding methods to implement. Can you provide me with some support?
I uploaded my use case ,could you please give me some code snippet based it?
As shown in p1 , After selecting these members and filling in the effort, the total effort of this task should be modified to the total effort of the selected members after the user clicks the save button . How can i achive it?
As shown in p2. in this case , if done hours greater than 0 ,users can not deselect it. How should I make this restriction.
picker: {
listeners: {
beforeShow({ source }) {
source.widgetMap.saveBtn.addListener('action', (ev) => {
// here you can access source.selectedRows to get the selection
// update the total based on selected rows
})
source.columns.get('units').hidden = true;
},
beforeSelectionChange(data){
if(condition)
return false;
}
Hi marcio , thanks for your reply.
For the first problem , The solution you provided is effective .
For the second, I found the eventListeners "beforeSelectionChange" has already triggered When the user opens resourceassignment editor, and then when the user selects or deselects resources, this event will be triggered twice.
p3 is the output when I open the editor, and p4 is the output when I select 'celia' .
I expect to perform a validation before the user deselects a certain resource data, checking whether the field doneHours in its row data is greater than 0. If it is, the user cannot deselect this resource data.
That's the expected behavior, that method is called when the user tries to select and also when deselecting some row, you can check that using the same event listener like this
beforeSelectionChange(data){
const { action, deselected } = data;
if(action === 'deselect') {
// Check if deselected contains info and if the doneHours is different than 0
// Boolean(0) will be false, so it should allow to deselect, if is different
// the deselection will be cancelled
return deselected[0] && !Boolean(deselected[0].doneHours);
}
return true;
}
@lanpeng Hi, it seems this issue has been already fixed - see the video I've uploaded into the ticket. Please try reproducing it with the latest version of our code and let me know?