I want to send the month of this row to an API endpoint.
If you Click on the cell then it runs a script.
- First issue is that I sometimes have the feeling I have to click twice on that button. One time to select the table/row and second time to Click Cell.
Then I run this script:
//grab the month from this row:
const month = currentRow._id.month;
//grab the year from the yearPicker.
const year = yearPicker.selectedItem;
//put it together in the right formatting for the API endpoint.
const formattedMonth = `${year}-${month.toString().padStart(2, '0')}`;
selected_month.setValue(formattedMonth);
//trigger the endpoint
await downloadCosts.trigger();
The first time this works (after clicking twice sometimes). The problem is that if I click two months quickly after each other, it sometimes still has the previous month in mind and sends that to the endpoint.
How can I fix this and make it reliable, so that you always get the data from that specific month back that you clicked. Should be pretty easy or?
Thanks so much for every help.