How to publish data from Query widget supporting file?

566
2
Jump to solution
08-12-2020 05:17 AM
MartinOwens1
Occasional Contributor II

So I've read the only way to publish data is though the Widget.js because it derives from base widget. My issue is that I would like to publish data from the SingleQueryResult.js in the Query widget. When the user selects a result from the query list I need it to publish data. I read something on being able to grab it from the "Parent Widget" but not sure how to implement this.

      _selectResultTr: function(tr, feature, result, layerDefinition, config) {
        this._unSelectResultTr();
        this.resultTr = tr;
		var currentAttrs = this.getCurrentAttrs();
        var config = currentAttrs && currentAttrs.config;
        var url = currentAttrs.config.url;
        var objectIdField = currentAttrs.config.objectIdField;
        var relationships = this._getCurrentRelationships();
		var feature = tr.feature;
        if (this.resultTr) {
          html.addClass(this.resultTr, 'jimu-state-active');
			
		var wManager = WidgetManager.getInstance();
		var pm = PanelManager.getInstance();    
			
		pm.showPanel(this._getWidgetConfig("PopupPanel")).then(lang.hitch(this, function() {
          this.publishData({
            'target': 'PopupPanel',
            'data': feature.attributes["PARID"]
          });
        }));
				
		  console.log("Result row was clicked " + feature.attributes["PARID"]);

		}
      },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Any help on this would be awesome!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Martin,

   There is already an example of publishing data from the SingleQueryResult.js in that file. Look at the _openAttributeTable method.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Martin,

   There is already an example of publishing data from the SingleQueryResult.js in that file. Look at the _openAttributeTable method.

0 Kudos
MartinOwens1
Occasional Contributor II

Ah good catch. I didn't even notice that at the bottom of the page. Thanks Robert!

0 Kudos