Modal popup message in legend widget

4131
5
Jump to solution
01-25-2017 04:42 AM
Labels (1)
GilbertoMatos
Occasional Contributor II

Hello!

Is there any way to display messages in a modal popup when clicking a layer in the caption widget? I have already managed to do everything and display the message, but with a default javascript alert. I need to do with a modal popup centralized.

Thanks for any help.

Gilberto.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Gilberto,

  Then just use the jimu/dijit/Message.

new Message({
  titleLabel:"your message title",
  message: "your message text"
 });

The Message dijit can even have custom button and you can specify the message type like "message/question/error"

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Gilberto,

  Then just use the jimu/dijit/Message.

new Message({
  titleLabel:"your message title",
  message: "your message text"
 });

The Message dijit can even have custom button and you can specify the message type like "message/question/error"

GilbertoMatos
Occasional Contributor II

Hello!

Thanks Robert. Perfect!!!

Gilberto.

0 Kudos
KevinMacLeod4
Frequent Contributor

Nice, thanks Robert. This seems like a more elegant way of accomplishing how I created a dialog window to display layer info. The only thing is mine allows users move the dialog box since it is a Dojo dialog and that was a requested user interface feature.  If this is useful to anyone.. - Enhanced Layer List - Metadata (1/31/17)  

0 Kudos
KennethWalker
New Contributor

Hi there; 
Forgive me, this is my first foray into widgets. I'm attempting to use the jimu/digit/Message. In your example, you use a titleLabel property, but I'm not seeing this property have any effect. I'm getting successful results setting the message property, and getting the popup with text as expected. In short, should I expect this titleLabel property to set a modal title? Or is there something I'm missing with this example snippet? Thanks very much.

0 Kudos
KenBuja
MVP Honored Contributor

I create messages using this function

_showMessage: function _showMessage(title, message) {
  new Message({
    titleLabel: title,
    message: message
  });
},
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

calling it like this

this._showMessage(this.nls.signinError, error.message);
‍‍‍‍

I'm able to use that syntax to get a modal message like this: