Attribute table not showing time component

176
3
Jump to solution
11-26-2020 01:39 AM
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

 

Reply
0 Kudos
1 Solution

Accepted Solutions
MVP Esteemed Contributor

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

Reply
0 Kudos
3 Replies
MVP Esteemed Contributor

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

Reply
0 Kudos
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

Reply
0 Kudos
MVP Esteemed Contributor

Victor,

 

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

Reply
0 Kudos