Select to view content in your preferred language

Include 'TIME' with Date field for Popup works but nothing exists for Query Results?

3929
12
Jump to solution
12-18-2015 09:27 AM
MichaelRobb
Honored Contributor

I have a question if this requires customizing or if I have missed a means of having this work out of the box.

Scenario

Web Map.  Configuring Popup, you can select to have Time included with Date field (Configuration)

As seen here:

1.png

The change would produce the following in a feature popup:

2.png

In the Web application Query widget... pointing to the same layer... If a Query is Initiated, the result as well as the Popup when clicking on the result shows the following:  (No Time)

3.png

Thoughts? 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Michael,

  OK, the change for 1.2 is simple to get the time to show.

In the Widget.js for the Query widget find the _tryLocaleNumber function and change the code from:

       _tryLocaleDate: function(date){
        var result = jimuUtils.localizeDate(date, {
          selector: 'date'
        });
        if(!result){
          result = date.toLocaleDateString();
        }
        return result;
      },

to:

      _tryLocaleDate: function(date){
        var result = jimuUtils.localizeDate(date);
        if(!result){
          result = date.toLocaleDateString();
        }
        return result;
      },

View solution in original post

0 Kudos
12 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   The query widget produces a layer using the query results and that new layer is not using the popup defined in the webmap, but the one defined in the Query widget UI.

0 Kudos
MichaelRobb
Honored Contributor

makes sense.  So I need to change the query code to be able to include Time?  I dont see any configuration ability in the Query Widget to also have time be included in date field calls.

Results settings only has the following:

11.png

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michael,

   By default the date field if it includes time will be displayed with date and time. Here is an example image of my app that has a date field and it is showing the time.

example.jpg

0 Kudos
MichaelRobb
Honored Contributor

Then something is wrong as the field contains Date/Time information as shown above when enabling with the custom popup.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michael,

  I just tested another layer with date and time and same result it shows up automatically. I am testing in WAB 1.3

example.jpg

0 Kudos
MichaelRobb
Honored Contributor

Perhaps this works in Version 1.3 and not in 1.2. (sigh)

I just tried a new blank new Web App, and get the same result (no TIME).

11.png

0 Kudos
MichaelRobb
Honored Contributor

Here is a screen shot of the Attribute Table in the same Test Web App..

11.png

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michael,

  OK, the change for 1.2 is simple to get the time to show.

In the Widget.js for the Query widget find the _tryLocaleNumber function and change the code from:

       _tryLocaleDate: function(date){
        var result = jimuUtils.localizeDate(date, {
          selector: 'date'
        });
        if(!result){
          result = date.toLocaleDateString();
        }
        return result;
      },

to:

      _tryLocaleDate: function(date){
        var result = jimuUtils.localizeDate(date);
        if(!result){
          result = date.toLocaleDateString();
        }
        return result;
      },
0 Kudos
MichaelRobb
Honored Contributor

How does one learn WABde as much as you have?

Thanks for showing that a simple selector bit of code is there and simply needs to be removed. 

This of course means I can select TIME only or DATE only at any instance. 

, {

          selector: 'date'

        }

0 Kudos