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?
Solved! Go to Solution.
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.
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.
Thanks Robert. Not ideal as I am using build in webappbuilder with OOTB attribute widget 😞 but I don't see anyway around this.
Cheers
Victor,
Unfortunately I don't see a way around it either.