How to make an API call on clicking a columnpickerbutton
Posted: Thu Mar 23, 2023 12:20 pm
by suhas.kachare
Hi Team ,
I am using the Bryntum Taskboard in React. I want to make an API call whenever I hide or unhide any column at my frontend using the top bar button (type: "columnpickerbutton" to
Can you please help me with this?
Please find below a screen recording for your reference.
Re: How to make an API call on clicking a columnpickerbutton
Posted: Thu Mar 23, 2023 1:03 pm
by tasnim
Hi,
Here is how you could achieve this
{ type : 'columnpickerbutton', menu : {
onItem() {
console.log('fires');
// make an api call
}
} }
Re: How to make an API call on clicking a columnpickerbutton
Posted: Fri Mar 24, 2023 9:36 am
by suhas.kachare
The above solution worked for me, as I was able to make an API call with selected columns.
Now, when I refresh the page after making an API call, I will get a selected columns array from the backend. Now, depending upon which columns are present in that array, I want to show only those columns that are selected in the column picker button.
But in my case, by default, all the values of the colorpicker button are selected.
Please find below attached screen recording for your reference.
Re: How to make an API call on clicking a columnpickerbutton
Posted: Fri Mar 24, 2023 12:51 pm
by alex.l
Hi suhas.kachare,
If you have that list of visible columns somewhere, you need to apply the state to your taskboard, as well as apply value to your picker.
We could give you more specific code if you will share with us your solution.
In two words, you need to go throw https://bryntum.com/products/taskboard/docs/api/TaskBoard/view/TaskBoard#property-columns and change state accordingly