Alias for column Name

732
2
Jump to solution
08-06-2015 06:23 AM
TerryGustafson
Occasional Contributor II

I have edited the following code to splice the fields I don't want and round the offset fields to 3 places..  Not I would like to ensure all of the Route ID fields are named Route and the MEAS fields are named Offset.  Here is the current code.  Is there anyway to create an alias for these column names?

'jimu-gp-resultrenderer-base jimu-gp-renderer-table',

function(){

this.inherited(arguments);

var fields = [];

if(this.value.fields){

this.value.fields;

else if(this.value.features && this.value.features.length > 0){

for(var p in this.value.features[0].attributes){

fields.push({

            name: p

          });

        }

      }

   

      fields.splice(0, 1);

      fields.splice(2, 2);

var columns = array.map(fields, function(field){

return {

label: field.name,

          field: field.name

        };

      

      });

var data = array.map(this.value.features, function(feature){

feature.attributes.Offset = Math.round(feature.attributes.MEAS * 1000)/1000;

return feature.attributes;

memStore = new Memory({

data: data

      });

this.table = new OnDemandGrid({

columns: columns,

        store: memStore

this.domNode);

      });

function(){

this.inherited(arguments);

this.table.startup();

}

  });

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Terry,

  Something like this should work then:

var columns = array.map(fields, function(field){

    var retval = {

        label: field.name,

        field: field.name

    };

    if(field.name === "Route ID"){

        retval.label = "Route";

    }

    if(field.name === "MEAS"){

        retval.label = "Offset";

    }

    return retval;

});

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Terry,

  Something like this should work then:

var columns = array.map(fields, function(field){

    var retval = {

        label: field.name,

        field: field.name

    };

    if(field.name === "Route ID"){

        retval.label = "Route";

    }

    if(field.name === "MEAS"){

        retval.label = "Offset";

    }

    return retval;

});

View solution in original post

TerryGustafson
Occasional Contributor II

that is exactly what I needed, thank you so much!!

0 Kudos