Our flexible Kanban board for managing tasks with drag drop


Post by suhas.kachare »

Hi Team ,

I am implementing a Bryntum Taskboard in react . I want to make a api call and fetch menuItem data from backend on taskMenu (...) click

Can you please guide me on this.

Thanks.


Post by tasnim »

Hello,

You could listen to taskMenuItem
It will fire when you click on a task menu item

new TaskBoard({
	listeners : {
		taskMenuItem : () => {
			// put your logic here
		}
	}
});

Post by suhas.kachare »

I want to make a api call on click of taskMenu (i.e 3 dot icon) and not on click of taskMenuItem


Post by Animal »

Could be that what you need is the taskmenubeforeshow event

https://bryntum.com/products/taskboard/docs/api/TaskBoard/view/TaskBoard#event-taskMenuBeforeShow

Screenshot 2023-02-23 at 10.43.20.png
Screenshot 2023-02-23 at 10.43.20.png (249.72 KiB) Viewed 720 times

Post by Animal »

I recommend experimenting with the catchAllevent to see what significant events are emitted. That's how I found this solution :)

Screenshot 2023-02-23 at 10.49.56.png
Screenshot 2023-02-23 at 10.49.56.png (470.46 KiB) Viewed 718 times

Post by suhas.kachare »

Can I make api call inside this ? and where should I write this code inside or outside of listener block

  taskboard.on('taskmenubeforeshow' ,({items})=>{
          console.log('taskMenu click')
    }),

Post by suhas.kachare »

I tried above code but it's not working as I have to make an api call . taskmenubeforeshow is not an async function.

listeners: {
 taskMenuBeforeShow: async({ items }) => {
        let response = await axiosWrapper.get("task.Actions.wm", { id: 17354 }, dispatch);
        let menuItems = response.data.items;
        menuItems.forEach((item) => {
          return (items[item.key] = item.text);
        });
      },
}

Can you please guide me with any other solution


Post by Animal »

The event does not currently allow async event handlers. This could be added. Here is a ticket : https://github.com/bryntum/support/issues/6249


Post by Animal »

I have the fix for this, but it will not make it into the 5.3.0 release. Minor releases are very regular though, the 5.3.1 release will allow you to use an async handler for the taskMenuBeforeShow event and mutate the items object to change the menu content.


Post Reply