Pushing Data From eSearch to Custom Print Template

09-01-2016 12:37 PM
New Contributor III

Okay, so I had asked this question before in regards to widget communication and we seemed to get that to work (with the _onSearchFinish and onReceiveData functions in the eSearch and Print widgets, respectively).  The widgets are communicating but now we are stuck on how exactly to take the data that we have pushed to the print widget and then send that data from the Print widget to populate custom text elements that we have in our "Export Web Map" print service that we attached to the Print widget.

We had this working in our old Javascript application and we think we are missing that part where we define our custom text elements but we are unsure of where to define them and what function we would use to do so.

eSearch: (example of pushing a parcel number from the eSearch to the Print widget):

_onSearchFinish: function (layerIndex, closeOnComplete, removing, adding, results) {
if(results.features.length === 1){
'target': 'Print',
'parcel': { "parcel_id": results.features[0].attributes.Parcel___}
}, true);

Print (this would go in the widget.js):

onReceiveData: function(name, source, params,historyData) {

(have no idea what would go after this)

further customization would be needed in the Print.js I am assuming but yet again we do not know exactly how to define our custom text elements so that the Print widget will send them to our print service so they are recognized to populate them in the templates.


0 Kudos
2 Replies
MVP Esteemed Contributor


   In the Print.js find this block of code:

        template.layoutOptions = {
          authorText: form.author,
          copyrightText: form.copyright,
          legendLayers: (this.layoutForm.legend.length > 0 && this.layoutForm.legend[0]) ?
            null : [],
          titleText: form.title,
          customTextElements: cteArray

and right after it add this line:

template.layoutOptions.customTextElements = [{yourcustomlayoutelementname: "blah blah blah"}];
New Contributor II

Hello Clarissa:

Could you make some advance to your issue with Robert answer? If it is ok, could you gime more details abuot it? 

Im working with standar query widget but the main idea is the same.

Populate the some fields on print widget with the result of query.


0 Kudos