How can I trigger a callback from custom context menu defined in dashAgGridFunction file using a dcc.store declared in app.layout

Im trying to trigger a callback from the custom context menu defined in the dashAgGridFunction.js file using the dcc.store declared in app.layout under ddk.header component, However its not all triggering this call back when I click the respective option in the context menu.

Im doing this way in my custom conextmenu action method:
const emailStore = document.getElementById(‘email-store’);
console.log(“email”,emailStore);
emailStore.data = JSON.stringify({ details: params.node.data });

            // Trigger the callback by dispatching a change event
            emailStore.dispatchEvent(new Event('change'));

Hello @codermemem,

You can now use a JS function called dash_clientside.set_props to change props directly in the react and trigger callbacks with it.

You just pass the id as the first argument, and an object with the props that you want to adjust.

sure will try this , But I have did it using other way by writing an api in flask and hitting that api by passing params instead

Yeah, you can do that too. But if you want dash to reflect, then you should use the dash_clientside.set_props.

For example, say you want to provide a notification to the user that the fetch request has been sent and then update the notification when the request has completed.

Yeah but when I tried this dash_clientside.set_props it’s not working at all, Do u have any example code to share?

What version of Dash are you using?

we are using enterprise version 5.4 and also when I’m trying to deploy the custom api in one of our envs Im getting 405 however its working fine in other env’s workspace. Just wanted to know if dash is blocking in any way?

Can you please provide an MRE for this?

It’s hard to understand exactly what isnt working…

Dash shouldnt be blocking anything like that.

Have you tried the examples that I listed here? the third one lines up with what you are trying to do.

sure, But Im not trying to use the set_props as its not working for us. However as mentioned previously I wrote a custom api to be called from dashAgGridFunction.js file and when I’m trying to deploy and test it in one of our envs its giving 405 error when its calling that API and In the response headers from network tab I see allow as GET,HEAD,OPTIONS. I’m not sure who set these because we didnt set anything as such to allow only these methods.

Another weird thing for the same env where its throwing 405 and when I try to run and test using workspace its working fine again and I’m totally not understanding of this behavior, can u please help?

Also, another quick question where can I find what all details will be included in get_user_data() method of auth in the dash enterprise docs as I wanted to see if it includes user email or not?

Thanks for ur help and quick replies!

As you are using DE, you should contact your Plotly Service rep for those answers.

dash_clientside.set_props should be working and is much cleaner to navigate, no hidden buttons, no extra steps to trigger a callback because it sends the updates via the dash ecosystem.