Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I pass data to my dialog? #44

Open
nicroto opened this issue Oct 7, 2018 · 9 comments
Open

How do I pass data to my dialog? #44

nicroto opened this issue Oct 7, 2018 · 9 comments

Comments

@nicroto
Copy link

nicroto commented Oct 7, 2018

I am creating custom components for my dialogs.

How do I pass data (parameters/context/etc.) to my dialog?

@symonsoft
Copy link

Through the options.

@nicroto
Copy link
Author

nicroto commented Nov 1, 2018

Through the options.

Are you suggesting that I add a property in the passed options (with name that's not being used by system property of the commponent) and then I will be able to read that within my custom component? Are options available through the DialogMixin?

@symonsoft
Copy link

Yes.

@serkandemirel0420
Copy link

How do we use passed property value in 'message' property? Like 'Do you want o delete x named item?'

@serkandemirel0420
Copy link

  <button v-confirm="{
                            loader: false,
                            ok: confirm, cancel: cancel,
                            okText: 'Ja',
                            cancelText: 'Nein',
                            reverse: true,
                            tooldid : 'sdsdsdsd',
                            message: `Möchten Sie die Wartung beim Werkzeug [+:tooldid] durchführen?`,
                            dataset:tool}" :data-tool="tool.ID">
                        Wartung
                    </button>

This gives a syntax error.

@Godofbrowser
Copy link
Owner

Godofbrowser commented Dec 24, 2018

@serkandemirel0420 You can try compose your message completely before passing it to the dialog like this:

message: `Do you want o delete ${itemName} named item?`

We're only replacing placeholders in strings that are built in. For message, you have to compose the message yourself. Your code should look similar to this:

<button v-confirm="{
                            loader: false,
                            ok: confirm, cancel: cancel,
                            okText: 'Ja',
                            cancelText: 'Nein',
                            reverse: true,
                            message: `Möchten Sie die Wartung beim Werkzeug ${tool.ID} durchführen?`,
                            dataset:tool}" :data-tool="tool.ID">
                        Wartung
                    </button>

@Godofbrowser
Copy link
Owner

Thank you @symonsoft That solution should work. @nicroto did it work for you?

@serkandemirel0420
Copy link

@Godofbrowser That indeed worked. Thanks!

@darrensapalo
Copy link

darrensapalo commented Aug 6, 2019

For a more graphic explanation, you can pass data to your custom vuejs dialog component via the options used to create the dialog as seen below (I used options.metadata property as my own custom property):

this.$dialog.confirm('What do you want to modify in this workflow?', {
      view: 'workflow-editor',
      html: true,
      animation: 'fade',
      backdropClose: true,
      metadata: 'The quick brown fox jumps over the lazy dog.'
    })

The options which is used to generate the confirm or alert dialog is actually used as a Vue prop. You can see that from the component, you can access this custom property from options. (See metadata property under options prop).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants