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
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.
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.
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.