Attribute table not showing time component

621
3
Jump to solution
11-26-2020 01:39 AM
VictorTey
Esri Contributor

 

Hi I have a feature layer that i add through the Add data widget however the time isn't showing in the attribute table. I can see it in the popup however. 

Can anyone advise what needs to be done?

VictorTey_0-1606383501350.png

 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Victor,

 

   You will have to edit the jimu/utils.js  mo.getDefaultPortalFieldInfo function.

  //return {fieldName,label,tooltip,visible,format,stringFieldOption}
  mo.getDefaultPortalFieldInfo = function(serviceFieldInfo){
    //serviceFieldInfo: {name,alias,type,...}
    var fieldName = serviceFieldInfo.name;
    var item = {
      fieldName: fieldName,
      label: serviceFieldInfo.alias || fieldName,
      tooltip: '',
      visible: false,
      format: null,
      stringFieldOption: 'textbox'
    };

    //https://developers.arcgis.com/javascript/jsapi/field-amd.html#type
    var type = serviceFieldInfo.type;
    switch (type) {
      case 'esriFieldTypeSmallInteger':
      case 'esriFieldTypeInteger':
        item.format = {
          places: 0,
          digitSeparator: true
        };
        break;
      case 'esriFieldTypeSingle':
      case 'esriFieldTypeDouble':
        item.format = {
          places: 2,
          digitSeparator: true
        };
        break;
      case 'esriFieldTypeDate':
        item.format = {
          dateFormat: "longMonthDayYearLongTime"
        };
        break;
    }
    return item;
  };

Notice I have added LongTime to the dateFormat.

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Victor,

 

   You will have to edit the jimu/utils.js  mo.getDefaultPortalFieldInfo function.

  //return {fieldName,label,tooltip,visible,format,stringFieldOption}
  mo.getDefaultPortalFieldInfo = function(serviceFieldInfo){
    //serviceFieldInfo: {name,alias,type,...}
    var fieldName = serviceFieldInfo.name;
    var item = {
      fieldName: fieldName,
      label: serviceFieldInfo.alias || fieldName,
      tooltip: '',
      visible: false,
      format: null,
      stringFieldOption: 'textbox'
    };

    //https://developers.arcgis.com/javascript/jsapi/field-amd.html#type
    var type = serviceFieldInfo.type;
    switch (type) {
      case 'esriFieldTypeSmallInteger':
      case 'esriFieldTypeInteger':
        item.format = {
          places: 0,
          digitSeparator: true
        };
        break;
      case 'esriFieldTypeSingle':
      case 'esriFieldTypeDouble':
        item.format = {
          places: 2,
          digitSeparator: true
        };
        break;
      case 'esriFieldTypeDate':
        item.format = {
          dateFormat: "longMonthDayYearLongTime"
        };
        break;
    }
    return item;
  };

Notice I have added LongTime to the dateFormat.

0 Kudos
VictorTey
Esri Contributor

Thanks Robert. Not ideal as I am using build in webappbuilder with OOTB attribute widget 😞 but I don't see anyway around this.

Cheers

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Victor,

 

   Unfortunately I don't see a way around it either. 

0 Kudos