question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom emit functions for Dialog Plugin with custom components

See original GitHub issue

I appreciate this is potentially a fairly niche case, but I found myself editing Quasar (global-dialog.js) to obtain some desired functionality for a project recently.

I use custom components with the dialog plugin all the time, and I found myself needing to pass an event back to the parent component, without triggering ok or cancel, so I added a function definition for onCustom() under API. This works perfectly for my use case, as I simply emit custom from my dialog component, and that passes the information back to the parent component and triggers the associated onCustom callback function. However, it strikes me as it could be useful for users to be able to define their own custom functions on specific emitted events.

My suggested feature request is a function prop when creating the dialog component for custom dialogs, allowing users to define their own callback functions (which can include payload), and the emitted event they would be associated with.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pdanpdancommented, Aug 13, 2021

The name onOk is unfortunate. In fact onCancel is the function to be called on cancel (is the .catch) and onOk is the one to be called when an action should be performed (is the .then) - you can pass payload when you emit, and branch your code based on the payload.

0reactions
mila76commented, Oct 25, 2021

Ok maybe an example for this for the documentation?? I’m not so confident to do by myself but i can try to create a simple example if needed

Read more comments on GitHub >

github_iconTop Results From Across the Web

useDialogPluginComponent composable - Quasar Framework
This composable is to be used on the custom components which a Dialog plugin is invoked with. It will bootstrap all the necessary...
Read more >
Reuse Quasar Dialog plugin with custom component on ...
I want to build a modal window to be reused in forms. I am using Dialog plugin and q-layout in a custom component....
Read more >
Dialog Plugin: Custom Component Various Usecase - CodePen
1. const { useQuasar, useDialogPluginComponent } = Quasar ; 2. const { ref, defineComponent, watch, nextTick } = Vue ; 3. ​ ;...
Read more >
TinyMCE 5: Creating a custom Dialog Plugin (and with ...
TinyMCE 5: Creating a custom Dialog Plugin (and with Custom Button Icons) · The easy one – basic form elements of different field...
Read more >
Custom dialog body components | TinyMCE Documentation
Events: Interacting with a selectbox component will fire the onChange function in the dialog's configuration. { type: 'selectbox', // component type name: ' ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found