Premium support for our pure JavaScript UI components


Post by dmitrypromx »

Hello Bryntum team,

How can I trigger my own function when a user clicks on the Delete button in the BryntumResourceUtilization component?
https://bryntum.com/products/gantt/examples/resourceutilization/
1) I would like to show/hide the Delete button based on conditions
2) I would like to prevent record deletion based on conditions and run my custom logic (API requests).

If it's difficult to achieve, how I can remove this button from the context menu? I can then add my custom "Delete" button in the "cellMenuFeature".


Post by tasnim »

You'd need configure https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskMenu feature
Here is how you could achieve it

        taskMenuFeature : {
            items : {
                deleteTask : false,
                customDeleteTask : {
                    text : 'Delete Task',
                    icon : 'fa fa-trash',
                    onItem : () => {
                        console.log('delete task');
                    }
                }
            }
        }

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by dmitrypromx »

Hi Tasnim,

Did you mean "cellMenuFeature" instead of "taskMenuFeature"? I see an error message: 'taskMenuFeature' does not exist in type 'BryntumResourceUtilizationProps'. I added it to the "cellMenuFeature" and saw new "Delete Task" button but the default "Delete" button was not removed from the context menu.


Post by tasnim »

Sorry, my bad! I thought you're asking about Gantt!

For Resource-Utilization you should use this

        cellMenuFeature : {
            items : {
                removeRow : false,
                customDeleteTask : {
                    text : 'Delete Task',
                    icon : 'fa fa-trash',
                    onItem : () => {
                        console.log('delete task');
                    }
                }
            }
        }

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by dmitrypromx »

Thank you! It works!


Post Reply