add image in featuretable grid

499
3
Jump to solution
12-07-2018 08:02 AM
MRReddy
Occasional Contributor

i was trying to add image same as above pic in feature table and on row-select zoom to point

below is my code for featuretable i tried to add image for objectid

Any suggestions

Thanks

 var myFeatureTable = new FeatureTable({
        featureLayer: layerdata,
        map: map,
        editable: false,
        dateOptions: {
            datePattern: 'M/d/y',
            timeEnabled: true,
            timePattern: 'H:mm',
        },
        syncSelection: true,
        showRelatedRecords: true,
        showAttachments: true,
        fieldInfos: [
{
        name: 'OBJECTID', 
        alias: 'Zoom to Location',
        //formatter: makeZoomButton('${objectid}')
}
        ],
        menuFunctions: [
              
        ],
        outFields: ["*"],
    }, 'myTableNode');

    myFeatureTable.startup();‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 function makeZoomButton(id) {
        //set the feature 'id' as the alt value for the image so that it can be used to query below
        var zBtn = "<div data-dojo-type='dijit/form/Button'><img src='ZoomIn.png' alt='" + id + "'";
        zBtn = zBtn + " width='18' height='18'></div>";
        return zBtn;
    }‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Malla,

  NOT an easy task, but here is some guidance:

fieldInfos

{
  name: 'OBJECTID',
  alias: ' ',
  editable: false,
  format: {
    template: '<span class="esri-icon-zoom-in-magnifying-glass"></span>'
  }
}

next

myFeatureTable.on("load", function(evt){
  myFeatureTable.grid.on("td.field-OBJECTID:click", function(evt){
    var OID = myFeatureTable.selectedRows[0].OBJECTID;
    //Do your zoom event stuff here
  });
});

myFeatureTable.startup();‍‍‍‍‍‍‍‍

I can't do all the coding for you, but this will get you started.

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Malla,

  NOT an easy task, but here is some guidance:

fieldInfos

{
  name: 'OBJECTID',
  alias: ' ',
  editable: false,
  format: {
    template: '<span class="esri-icon-zoom-in-magnifying-glass"></span>'
  }
}

next

myFeatureTable.on("load", function(evt){
  myFeatureTable.grid.on("td.field-OBJECTID:click", function(evt){
    var OID = myFeatureTable.selectedRows[0].OBJECTID;
    //Do your zoom event stuff here
  });
});

myFeatureTable.startup();‍‍‍‍‍‍‍‍

I can't do all the coding for you, but this will get you started.

0 Kudos
MRReddy
Occasional Contributor

Thanks Robert, it worked

0 Kudos
ImtiyazPasha
Occasional Contributor

How to implement same(add image in featuretable grid)

in ArcGIS API for js 4. x FeaturerTable widget, please suggest.

0 Kudos