For v1.3 Robert provided some additional code that enables editing of time in a date time field (I can't find the discussion at the moment)
Has anyone gotten this to work in 2.0? I've attempted to re-enable this functionality but it doesn't appear that 2.0 DE is recognizing my changes. There could also have been other changes from 1.3 to 2.0 that are neutering this but I want to get some feedback from others.
Solved! Go to Solution.
Seth,
Here is the fix for 2.0 (line 12 - 21 and 32 - 41):
array.forEach(layerInfo.fieldInfos, function(fieldInfo) { // compitible with old version of config, // to decide which file will display in inspector. var webmapFieldInfo = getFieldInfoFromWebmapFieldInfos(webmapFieldInfos, fieldInfo); if(fieldInfo.visible === undefined) { // compatible with old version field Info that does not defined // the visible attribute. if(webmapFieldInfo) { if( webmapFieldInfo.isEditable || webmapFieldInfo.isEditableSettingInWebmap || webmapFieldInfo.visible) { if (webmapFieldInfo.format !== null) { if (webmapFieldInfo.format.dateFormat !== null) { if (webmapFieldInfo.format.dateFormat === "shortDateShortTime" || webmapFieldInfo.format.dateFormat === "shortDateShortTime24" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime24") { webmapFieldInfo.format.time = true; } } } newFieldInfos.push(webmapFieldInfo); } } else { newFieldInfos.push(fieldInfo); } } else { // the fieldInfo has defined the visble attribute(since online4.1). if(fieldInfo.visible || fieldInfo.isEditable) { //push to newFieldInfos if(webmapFieldInfo) { if (webmapFieldInfo.format !== null) { if (webmapFieldInfo.format.dateFormat !== null) { if (webmapFieldInfo.format.dateFormat === "shortDateShortTime" || webmapFieldInfo.format.dateFormat === "shortDateShortTime24" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime24") { webmapFieldInfo.format.time = true; } } } newFieldInfos.push(webmapFieldInfo); } else { newFieldInfos.push(fieldInfo); } } } }, this);
Junshan Liu This would be a great thing to add to the WAB core so that editing dates with time is more in line with the AGOL Map Viewer experience.
Seth,
I have wrote so much code I don't remember that one. If you can show me the code it may refresh my memory and I should be able to get that working for 2.0
Hi Robert,
Of course. Thank you for replying and for assisting the rest of us.
Here's the discussion: Edit Widget - time not visible when DateTime field has time enabled
In the Edit Widget's widget.js file I made an identical insertion to the _converConfiguredLayerInfos function.
But I'm not seeing my time editing reflected in 2.0 DE.
Seth,
Here is the fix for 2.0 (line 12 - 21 and 32 - 41):
array.forEach(layerInfo.fieldInfos, function(fieldInfo) { // compitible with old version of config, // to decide which file will display in inspector. var webmapFieldInfo = getFieldInfoFromWebmapFieldInfos(webmapFieldInfos, fieldInfo); if(fieldInfo.visible === undefined) { // compatible with old version field Info that does not defined // the visible attribute. if(webmapFieldInfo) { if( webmapFieldInfo.isEditable || webmapFieldInfo.isEditableSettingInWebmap || webmapFieldInfo.visible) { if (webmapFieldInfo.format !== null) { if (webmapFieldInfo.format.dateFormat !== null) { if (webmapFieldInfo.format.dateFormat === "shortDateShortTime" || webmapFieldInfo.format.dateFormat === "shortDateShortTime24" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime24") { webmapFieldInfo.format.time = true; } } } newFieldInfos.push(webmapFieldInfo); } } else { newFieldInfos.push(fieldInfo); } } else { // the fieldInfo has defined the visble attribute(since online4.1). if(fieldInfo.visible || fieldInfo.isEditable) { //push to newFieldInfos if(webmapFieldInfo) { if (webmapFieldInfo.format !== null) { if (webmapFieldInfo.format.dateFormat !== null) { if (webmapFieldInfo.format.dateFormat === "shortDateShortTime" || webmapFieldInfo.format.dateFormat === "shortDateShortTime24" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime" || webmapFieldInfo.format.dateFormat === "shortDateLEShortTime24") { webmapFieldInfo.format.time = true; } } } newFieldInfos.push(webmapFieldInfo); } else { newFieldInfos.push(fieldInfo); } } } }, this);
Junshan Liu This would be a great thing to add to the WAB core so that editing dates with time is more in line with the AGOL Map Viewer experience.
Thank you Robert! You've been a great help, as always.
@rescheitlin Thanks very much for your fix code!
@Xiaodong Wang I copy this email to Edit widget developer to fix this issue.
Talked with the Edit widget developer, this issue has been fixed in the latest code, will be available in UC release.
The fix code is almost the same with your code. Thanks very much!@ Robert.