API Docs for:
Show:

Y.DataTable.EditorOptions.date Class

Popup Cell Editor "date"

This View configuration is used to setup a bare-bones date editor as a popup-type cell editor. Configuration is setup with both prepFn and saveFn to convert the Date object.

Basic Usage
   // Column definition
   { key:'firstName', editor:"date"}

   // Column definition ... with user-defined dateFormat and disabling keyfiltering
   { key:'firstName',
     editor:"text", editorConfig:{ dateFormat: '%Y-%m-%d', keyFiltering:null }
   }
Standard Configuration

This editor creates a simple INPUT[text] internally within the popup Editor View container positioned directly over the TD element. Additionally, if a "dateFormat" editorOption is provided the value of the INPUT will be pre-processed with that format. On save, the value of the input is parsed back to a Date object for the DT.

The configuration {Object} for this cell editor View is predefined as;

   Y.DataTable.EditorOptions.date = {
       BaseViewClass:  Y.DataTable.BaseCellPopupEditor,
       name:           'date',

       // Template.Micro setup
       templateObject: {
           html: '<input type="text" title="inline cell editor" class="<%= this.classInput %>"  />'
       },

       inputKeys:  true,
       inputWidth: 75,   // width of the INPUT[text]

       // only allow keyboard input of digits or '/' or '-' within the editor ...
       keyFiltering:   /\/|\d|\-/,

       // Function to call prior to displaying editor, to put a human-readable Date into
       //  the INPUT box initially ...
       prepFn: function(v){
           var dfmt = this.get('dateFormat') || "%D";
           return Y.DataType.Date.format(v,{format:dfmt});
       },

       // Function to call after Date editing is complete, prior to saving to DataTable ...
       //  i.e. converts back to "Date" format that DT expects ...
       saveFn: function(v){
           return Y.DataType.Date.parse(v) || undefined;
       }
   };

PLEASE NOTE: All other attributes from the BaseViewClass apply and can be included within the editorConfig object.

Item Index