Search code examples
gisesriarcgis-js-api

ESRI js API Date Time Picker


I'm using a Feature Layer with a Date field type, and I can see in the database that this is a datetime field, and would like to use a datetime picker in the js editor. I've tried using a jquery datetime picker, and cannot override the default ESRI/Dojo date picker.

Can anyone point me in the right direction?


Solution

  • Using a custom dijit in your editor is the correct solution. You need to tell the editor to use a different dijit when displaying the edit window:

    ...

    var editSettings = {
        map: myMap,
        layerInfos: {
            "featureLayer": myLayer,
            "infoTemplate": myTemplate,
            "fieldInfos": [
                 {'fieldName':'DATESTUFFHAPPENED','label':'Stuff Happened','customField':new dijit.form.DateTimeWidget({options_go_here})}
            ]
        }
    };
    var params = {settings: editSettings};
    var editor = new esri.dijit.editing.Editor(params, 'my-div');
    

    There's a possible custom widget here that you might find useful?