How do I use dynamic variables in the ModalDialog.Show function?


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by John C on 16th October 2017
Awhile ago, you helped me in getting my information into a table using the keys in RGraph to reference an iframe with ModalDialog.Show. Thank you.

I am trying to make my website consistent, which would really mean using something other than an iframe. I can't get it to look the same as my other modal popups. However, you said that ModalDialog.Show(route...) doesn't work. I looked closer at this page:

www.rgraph.net/canvas/docs/integrating-RGraph-with-external-libraries.html

Instead of putting everything in a string, I can use a div id that RGraph calls. My question is, can you pass a variable (or model, in my case, as I'm using MVC) in so you can have dynamic information in your HTML?

- John C
Posted by Richard on 16th October 2017
Hi there,

Well I'm not entirely sure that I understand what it is that you're doing. It sounds like you may need to update the ModalDialog code (the Show function) to do what you want.

You could have it accept a third argument - an array - that contains various variables that get substituted in when the dialog is about to be shown.

RGraph has a nice string formatting function that may help with this that gets added to the JavaScript String object when common.core file is included. You use it like this:

var myString = 'Holly was at {1} on {2} before the world exploded!';

myString.format(
     'school',
     'Tuesday'
);

Richard
Posted by John C on 16th October 2017
I'm trying to display a table in the modal dialog that has all the elements in they key that is clicked on (so, if the red part of the pie had 213 names in it, I would get a table with those 213 names). The table I can do in HTML. The trick is getting those names.

- John C
Posted by Richard on 16th October 2017
Hi there,

I think that you'll need to modify the ModalDialog.ShowDialog() function to have it pull the relevant set of names.

Richard
Posted by John C on 16th October 2017
OK, thank you. I don't suppose there's a way I can skip the ModalDialog part completely and just have the key click link directly to a route (like www.stores.com/3 or whatever)?

- John C
Posted by Richard on 16th October 2017
Hi there,

The interactive key has an event that you can use:

onafterinteractivekey

I've made up an example of it here:

www.rgraph.net/tests/bar/interactive-key.html

The number being alert()ed is the index of the key element (IIRC).

Richard

Add a reply




« Back to message list