What Variables are the fields in the Group Layer WAB Widget Populated by?

674
3
10-19-2021 08:26 AM
Labels (3)
NicoKroes
New Contributor II

Hello:

Does any one know what variables in the 'Group Filter' widget's JavaScript that the dropdowns in the Group Filter Widget get their values from (See attached image)? I am looking to use the values in these variables in another widget. Any information that you can provide would be great.

Thanks,

Nico

 

Group Filter Widget.png

 

Tags (2)
0 Kudos
3 Replies
NicoKroes
New Contributor II

@RobertScheitlin__GISP 

Do you know what variables in the GroupFilter widget.js file in Web App Builder store the values that the user enters into the filter criteria dropdowns in the GroupFilter widget. I am attempting to grab the values that the user selects in each dropdown in the GroupFilter widget and send these values to another widget that displays what values the user currently has selected in the GroupFilter widget. I included a photo below of what will be populated in the "receiving widget". Can you provide me a little guidance or even a hint on what variable I should be using to grab user selected values in the groupfilter widget?

Any assistance provided will be greatly appreciated. Thanks.

Current Selections.PNG

 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

@NicoKroes 

The filter and group filter widgets are very difficult to follow in code. Each parameter of the filter gets a jimu/dijit/FilterParameter and that module uses _SingleFilterParameter. If you attempt to follow the code then the FilterParameter module has a _spObj that holds all the _SingleFilterParameter objects. The _SingleFilterParameter has a method called getValueObject.

NicoKroes
New Contributor II

Thank you @RobertScheitlin__GISP 

I have been using the Widgets inside the \WebAppBuilderForArcGIS\client\stemapp\widgets\samplewidgets\WidgetCommunication folder as a starting point. I am planning to add the code from the 'widget.js' file in the WidgetA (Sending Message Widget) into another copy of the GroupFilter Widget. Below is the code that I had in mind for when the GroupFilter widget sends the currently entered filter user parameters to the second widget.

_onPublishClick: function() {
      this.publishData({
        message: 'I am widget Test' + _spObj
      });
      this.i ++;
      this.pubInfoNode.innerText = 'Publish ' + this.i;
    },

For the receiving widget, I plan to grab each user filter parameter from the group filter widget and display its value on the receiving widget, I was thinking of code similar to this in onReceiveData below.

onReceiveData: function(name, widgetId, data, historyData) {
    //filter out messages
    if(name !== 'GroupFilterTest'){
      return;
    }

    var msg = '<div style="margin:10px;">' +
      '<b>Groups Selected</b>:' + _spObj[0] + //grabs user parameter(s) from first filter criteria (Groups Selected)
      '<br><b>Driver Selected:</b>' + _spObj[1] + //grabs user parameter(s) from second filter criteria (driver(s) selected)
      '<br><b>Date Range Selected:</b>' + _spObj[2]; //grabs user parameter(s) from thurd filter criteria (date range selected)

    //handle history data
    if(historyData === true){
      //want to fetch history data.
      msg += '<br><b>historyData:</b>' + historyData + '. Fetch again.</div>';
      this.messageNode.innerHTML = this.messageNode.innerHTML + msg;
      this.fetchDataByName('WidgetA');
    }else{
      msg += '<br><b>historyData:</b><br>' +
        array.map(historyData, function(data, i){
          return i + ':' + data.message;
        }).join('<br>') + '</div>';
      this.messageNode.innerHTML = this.messageNode.innerHTML + msg;

What do you think? Am I approaching grabbing the values from the group filter widget incorrectly. Let me know if I can provide any further clarification.

 

 

0 Kudos