Loading ...
Sorry, an error occurred while loading the content.

Datatable inline cell editing on an empty date cell

Expand Messages
  • Arnaud Limbourg
    Hi all, I m posting as it might be useful for some of you (and there might be a better way). When using a datatable with inline cell editing there is a problem
    Message 1 of 1 , Nov 3, 2008
    • 0 Attachment
      Hi all,

      I'm posting as it might be useful for some of you (and there might be a
      better way).

      When using a datatable with inline cell editing there is a problem with
      the date editor when your cell is empty. It may happen you have to
      display a datatable with some dates filled in and some other cells
      staying empty until the user fills them.

      In the current implementation the calendar is not shown when the field
      is empty (or has, say, a - character in it) because the editor expects a
      date object.

      A simple solution I found is to override the doBeforeShowCellEditor. In
      case of a null value I force it to the default value like so:

      myDataTable.doBeforeShowCellEditor = function (oCellEditor)
      {
      if (oCellEditor.value === null) {
      oCellEditor.value = oCellEditor.defaultValue;
      }
      return true;
      };

      It might not be the prettiest way but it appears to be working.
    Your message has been successfully submitted and would be delivered to recipients shortly.