show domain in dgrid/OnDemandGrid

3973
11
07-15-2015 10:04 AM
AuraRamos_Lora1
New Contributor II

Could you help me, please to show domain in dgrid, this is functionally in infowindow but in grid puts the code,  not the description.of domain.

var outFieldsProy = ["PROYECTO", "NOMBRE", "ESC250", "AERONAVE"]

var gridProy = new (declare([Grid, Selection,ColumnHider, ColumnReorder, ColumnResizer]))({

      bufferRows : Infinity,

      columns : {

        PROYECTO : "Proyecto",

        NOMBRE : "Nombre",

        ESC250 : "Escala 250",

        AERONAVE : "Aeronave"

}

    }, "divGrid");

function populateGrid(results) {
            // var gridData;

            dataQuakes = arrayUtils.map(results.features, function (feature) {
                return {
                    "PROYECTO": feature.attributes[outFieldsProy[0]],
                    "NOMBRE": feature.attributes[outFieldsProy[1]],
                    "ESC250": feature.attributes[outFieldsProy[2]],
                    "AERONAVE": feature.attributes[outFieldsProy[3]]

                    };

            });

          

            var memStore = new Memory({

                data: dataQuakes

            });

            gridProy.set("store", memStore)           

        }

Thanks

0 Kudos
11 Replies
RickeyFight
MVP Regular Contributor

Thejus,

Do I add a formatter to the field in the columns section?

 var columns = [{
        label: "", //wasn't able to inject an HTML <div> with image here
        field: "OBJECTID",
        formatter: makeZoomButton
      }, {
        label: "Location",
        field: "Location"
      }, {
        label: "Priority",
        field: "Priority"
  ,formatter:codedValueDomain
      },{
0 Kudos
thejuskambi
Occasional Contributor III

Hello Rickey,

The above solution show the way to replace the codedDomain values before the dgrid store has been set. but, if you want to change the value using the formatter, then it is also possible. But, you need to make sure that the function passed to the formatter has access to the FeatureLayer and information regarding the field name. you need to get the field from the featurelayer for the fieldname. Then you can use the method provided in the other thread (QueryTask and coded domain values) to return the value instead of the code.

Hope this was helpful.

Thejus

0 Kudos