eSearch widget customization

6167
20
Jump to solution
03-25-2016 08:20 AM
ZhujingXia
Occasional Contributor II

Robert,

I'd like to customize the Esearch little bit. I'd like to get a report for the result of the search( may be a new window of HTML page to list the result attribute info). I created a 'report' button next to the 'clear' button on the result tab. if user click on the 'report' button a new window will open to show all the attribute info. I could get the result data from

this.currentFeatures.attributes.ADDRESS;

this.currentFeatures.attributes.Parcel_ID;

I have to list all the field names individually, I have a long list of the field name. Is there a easy way get the field name and attribute info all together within a for loop?

Thanks

1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Zhujing,

  Sure you have that data already (the att object) you just need to make this adjustment:

var featureAttributes = this.currentFeatures.attributes;  
for (var att in featureAttributes) {  
  console.info(att + ": " + this.currentFeatures.attributes[att]);  
}

View solution in original post

20 Replies
RobertScheitlin__GISP
MVP Emeritus

Zhujing,

  Sure just do something like this:

var featureAttributes = this.currentFeatures.attributes;
for (var att in featureAttributes) {
  console.info(this.currentFeatures.attributes[att]);
}
ZhujingXia
Occasional Contributor II

Robert,

Yes. That will return all the attribute values. But is there a way to get the Field Name as well? I'd like to show the field name and the value of the attribute together.

For instance, Address: 18 New Hempstead RD

                      Parcel ID : 12345

                      Owner: John Smith

                      ...........

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Zhujing,

  Sure you have that data already (the att object) you just need to make this adjustment:

var featureAttributes = this.currentFeatures.attributes;  
for (var att in featureAttributes) {  
  console.info(att + ": " + this.currentFeatures.attributes[att]);  
}
ZhujingXia
Occasional Contributor II

Great. Thanks Robert

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Zhujing,

  Your welcome don't forget to mark this thread as answered.

0 Kudos
ZhujingXia
Occasional Contributor II

Robert,

Could you let me know where  you set up the ZoomAll and the Clear button in the Result tab to let them not display when there is no result. I'd like to do the same thing for my Report button.

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Zhujing,

  Sure it is here:

_clearLayers: function () {

        this._removeAllResultLayers();

        html.setStyle(this.btnZoomAll, 'display', 'none');

        html.setStyle(this.btnClear, 'display', 'none');

        html.setStyle(this.btnClear2, 'display', 'none');

        html.setStyle(this.btnClear3, 'display', 'none');

        html.setStyle(this.btnExport, 'display', 'none');

      },

ZhujingXia
Occasional Contributor II

Worked.

0 Kudos
ZhujingXia
Occasional Contributor II

Robert,

I have another question. Is there a way to know which layer this.currentFeaturs got from? I'd like to put different title in my report dependences on the data layer..

Thanks

0 Kudos