How to add custom text box to WAB app

3514
22
Jump to solution
08-07-2017 03:37 PM
RodKuhns
New Contributor II

I have a custom WAB application that zooms to a parcel feature upon startup using URL parameters passed in.   I would like to add a Text Box, Title Box or some type of HTML table to display information about the feature, such as Parcel ID, Owner name, County, Township, Range, Section etc.    This could be displayed on top of the map, covering a portion of the map in a corner, or in a dedicated area above the map.  Can anyone provide some suggestions about how I might go about adding this type of labeling that will come from a JavaSript function?  I have the function to retrieve the data elements, I'm in need of ideas on how to display them on the WAB interface.

Thanks!

Rod Kuhns

GIS Applications Architect, MBS

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Here is a snippet (as with much of the WAB library you will not find documentation on it, but if you look at the otb widget you will find many examples):

define([
'jimu/dijit/Message',
.....
],
  function (
    Message,
.....
) {

//Some code to use it
            var msgStr = this.nls.widgetverstr + ': ' + this.manifest.version;
            msgStr += '\n' + this.nls.wabversionmsg + ': ' + this.manifest.wabVersion;
            msgStr += '\n' + this.manifest.description;
            new Message({
              titleLabel: "your title",
              message: msgStr
            });

View solution in original post

22 Replies
RobertScheitlin__GISP
MVP Emeritus

Rod,

   Do you have popups enabled for the parcel layer? If so then you can just get the map.center geometry and use that to fire a layer click programatically to show the parcels popup.

0 Kudos
RodKuhns
New Contributor II

Thanks Robert!  We have a unique requirement in that the user department we are building this for wants this interface to highlight and display information only on the parcel passed in on the command line.  We have that working in that the WAB site starts up with only the parcel 'requested' highlighted.  They specifically don't want this app used for exploring information about neighboring parcels.  There is specific reasons that I won't elaborate on.  That is a great idea to turn on the popup and pop it up... but in this case, we only want the user to see the attributes for the selected parcel.  Given that... can you think of another tool or a way to prevent clicking on other parcels?

0 Kudos
RickeyFight
MVP Regular Contributor

You could have a form of the filter widget that only shows searched for percales. The other parcels would show on a secondary layer but would not be selectable. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rod,

  Well there are several ways to do this but that was the least complicated. So if you already have the parcel highlighted then you must have done a Query using QueryTask so you have the attributes you want. You can use the jimu Message dijit to display the data.

0 Kudos
RodKuhns
New Contributor II

Thanks!  I do have all the attributes and just need a means to display them.  The jimu Message digit sounds perfect.  Can you help me find a sample usage or doc or reference on it... I'm not finding any info on it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Here is a snippet (as with much of the WAB library you will not find documentation on it, but if you look at the otb widget you will find many examples):

define([
'jimu/dijit/Message',
.....
],
  function (
    Message,
.....
) {

//Some code to use it
            var msgStr = this.nls.widgetverstr + ': ' + this.manifest.version;
            msgStr += '\n' + this.nls.wabversionmsg + ': ' + this.manifest.wabVersion;
            msgStr += '\n' + this.manifest.description;
            new Message({
              titleLabel: "your title",
              message: msgStr
            });
RodKuhns
New Contributor II

Worked Perfectly!  Thank you Robert!

0 Kudos
GeorgeKatsambas
Occasional Contributor III

I too am looking to add a text box on a WAB map with some sort of disclaimer, in addition to the splash screen, the code you posted earlier where would I add it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   The code can go in a custom widget or some widget like the splash widget that open on startup.