Is it possible to format fields that appear in tables within the map service?

In the table results after a spatial query, date fields are converted to UTC rather than duplicating the values from the original data (e.g., original data is "1/2/2017"; the table in the CMV shows "1/1/2017 6:00 p.m."). Export.js was modified with a Date() function so the exported file has the correct date. Also, a field that is a multi-digit integer value is appearing as a floating point with decimal places and commas (e.g., value: 123456, table field: 123,456.000). This value is a code and isn't a decimal value.

  • What table widget(s) are you using? Jan 20, 2017 at 1:09
  • Tables are defined in the \js\gis\dijit\Find.js code. There is also an AttributesTable widget that doesn't have documentation.
    – user90009
    Jan 20, 2017 at 23:56

1 Answer 1


This is two separate questions it seems.

formatting the attributes table

You can pass a gridOptions object in the tables object that can format columns fairly easily. See this link for details on how this looks in context.

gridOptions: {
     columns: [{
          field: 'incidentnm',
          label: 'Name'
          field: 'inspdate',
          label: 'Inspected',
          width: 150,
          get: function (object) { // allow export as a proper date
               return getDateTime(object.inspdate);
          formatter: formatDateTime

In the example, formatDateTime is a function that would format your date. FYI, the attributes table and other widgets have extensive documentation in their relevent repo: https://github.com/tmcgee/cmv-widgets#attributes-tables

formatting the find widgets table.

This isn't as easy, since the widget hasn't received a lot of attention now that most people are using the Search widget that tmcgee has in the same repo. But its still possible if you modify the widget when the grid is created.

Somewhere around these lines you would have to do this:

this.resultsGrid = new Grid({
     selectionMode: this.selectionMode,
     cellNavigation: false,
     showHeader: true,
     store: this.resultsStore,
     columns: [{
        label: 'First Name',
        field: 'first'
        label: 'Last Name',
        field: 'last'
        label: 'Age',
        field: 'age',
        get: function(object){
            return (new Date() - object.birthDate) / 31536000000;
}, this.findResultsGrid);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.